Skip to content

Instantly share code, notes, and snippets.

@cubicleDowns
Created October 13, 2014 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cubicleDowns/f5fade38e2fb1e1934c7 to your computer and use it in GitHub Desktop.
Save cubicleDowns/f5fade38e2fb1e1934c7 to your computer and use it in GitHub Desktop.
Angular Error Exception Module
//inject the module as such
var myApp = angular.module("myApp", ['ngExceptions'])
// put this in one file.
(function(window, angular) {'use strict';
/**
* @ngdoc module
* @name ngExceptions
* @description
*
* # ngExceptions
*/
// define ngExceptions module
var ngExceptions = angular.module('ngExceptions', [])
.config([ '$provide', function($provide){ $provide.decorator('$exceptionHandler', function(){
return function(exception, cause){
console.log("angularError", {'error': exception, 'userdata': {'cause': cause}});
};
});
}]);
})(window, window.angular);
@cubicleDowns
Copy link
Author

Replace console.log with whatever reporting system you use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment