aboutsummaryrefslogtreecommitdiffstats
path: root/src/service/exceptionHandler.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/service/exceptionHandler.js')
-rw-r--r--src/service/exceptionHandler.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/service/exceptionHandler.js b/src/service/exceptionHandler.js
new file mode 100644
index 00000000..dd99a373
--- /dev/null
+++ b/src/service/exceptionHandler.js
@@ -0,0 +1,22 @@
+/**
+ * @workInProgress
+ * @ngdoc service
+ * @name angular.service.$exceptionHandler
+ * @requires $log
+ *
+ * @description
+ * Any uncaught exception in angular expressions is delegated to this service.
+ * The default implementation simply delegates to `$log.error` which logs it into
+ * the browser console.
+ *
+ * In unit tests, if `angular-mocks.js` is loaded, this service is overriden by
+ * {@link angular.mock.service.$exceptionHandler mock $exceptionHandler}
+ *
+ * @example
+ */
+var $exceptionHandlerFactory; //reference to be used only in tests
+angularServiceInject('$exceptionHandler', $exceptionHandlerFactory = function($log){
+ return function(e) {
+ $log.error(e);
+ };
+}, ['$log'], true);