Skip to content

Instantly share code, notes, and snippets.

@an-tk
Created January 4, 2016 15:02
Show Gist options
  • Save an-tk/e7435ccc220b554d42ae to your computer and use it in GitHub Desktop.
Save an-tk/e7435ccc220b554d42ae to your computer and use it in GitHub Desktop.
log Angular errors with Rollbar
angular.module('app').config(function($provide) {
$provide.decorator('$exceptionHandler', ['$delegate', '$injector', function($delegate, $injector) {
var $location;
return function(exception, cause) {
$location = $location || $injector.get('$location');
var url = $location.absUrl();
$delegate(exception, cause);
Rollbar.error( url + ': ' + exception.stack);
};
}]);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment