File tree 1 file changed +15
-1
lines changed
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 9
9
* Any uncaught exception in angular expressions is delegated to this service.
10
10
* The default implementation simply delegates to `$log.error` which logs it into
11
11
* the browser console.
12
- *
12
+ *
13
13
* In unit tests, if `angular-mocks.js` is loaded, this service is overridden by
14
14
* {@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing.
15
15
*
16
+ * ## Example:
17
+ *
18
+ * <pre>
19
+ * angular.module('exceptionOverride', []).factory('$exceptionHandler', function () {
20
+ * return function (exception, cause) {
21
+ * exception.message += ' (caused by "' + cause + '")';
22
+ * throw exception;
23
+ * };
24
+ * });
25
+ * </pre>
26
+ *
27
+ * This example will override the normal action of `$exceptionHandler`, to make angular
28
+ * exceptions fail hard when they happen, instead of just logging to the console.
29
+ *
16
30
* @param {Error } exception Exception associated with the error.
17
31
* @param {string= } cause optional information about the context in which
18
32
* the error was thrown.
You can’t perform that action at this time.
0 commit comments