Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit c87f5f3

Browse files
committed
docs($exceptionHandler): add a note about cases when exceptions are not delegated to the
$exceptionHandler Add a note in $exceptionHandler's documentation about cases when exceptions are not delegated to the $exceptionHandler, because they are executed outside of the Angular context. Most notable such cases being the DOM event listeners registered using jqLite's/jQuery's on/bind methods. Closes #7909
1 parent b119251 commit c87f5f3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/ng/exceptionHandler.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@
2727
* This example will override the normal action of `$exceptionHandler`, to make angular
2828
* exceptions fail hard when they happen, instead of just logging to the console.
2929
*
30+
* <hr />
31+
* Note, that code executed outside of the Angular context does not delegate exceptions to the
32+
* {@link ng.$exceptionHandler $exceptionHandler}. Some common such cases include functions invoked
33+
* by third party libraries and callbacks associated with XHR, setTimeout/setInterval and browser
34+
* DOM events (including callbacks registered using jqLite's/jQuery's `on`/`bind` methods).
35+
* For some of those cases, Angular provides native wrappers that transparently manage the $digest
36+
* cycle and delegate exceptions to the {@link ng.$exceptionHandler $exceptionHandler} (e.g.
37+
* {@link ng.$http $http} for XHR, {@link ng.$timeout $timeout}/{@link ng.$interval $interval} for
38+
* setTimeout/setInterval). For the rest, you can explicitly ensure that the code is excecuted
39+
* inside of the Angular context, by wrapping it in
40+
* {@link ng.$rootScope.Scope#$apply scope.$apply()}.
41+
*
3042
* @param {Error} exception Exception associated with the error.
3143
* @param {string=} cause optional information about the context in which
3244
* the error was thrown.

0 commit comments

Comments
 (0)