Skip to content

Instantly share code, notes, and snippets.

@jico
Last active November 16, 2015 04:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jico/e4d14ae301ed93132823 to your computer and use it in GitHub Desktop.
Save jico/e4d14ae301ed93132823 to your computer and use it in GitHub Desktop.
// Log Angular exceptions to Sentry
$provide.decorator('$exceptionHandler', function($delegate) {
return function(exception, cause) {
$delegate(exception, cause);
Raven.captureException(exception, {
extra: {
cause: cause,
member_email: member.email
}
});
}
});
// Log HTTP response errors to Sentry
$provide.factory('ravenHttpInterceptor', function($q) {
return {
responseError: function(rejection) {
var err = new Error('HTTP response error');
Raven.captureException(err, {
extra: {
config: rejection.config,
status: rejection.status,
data: rejection.data,
member_email: member.email
}
});
$q.reject(rejection);
}
}
});
$httpProvider.interceptors.push('ravenHttpInterceptor');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment