admin管理员组文章数量:1287254
I don't want $exceptionHandler to handle any exceptions - I want them to propegate up to the browser (primarily for IE testing in Visual Studio).
I'd tried overriding $exceptionHandler and simply rethrowing the error, which gives me the 10 iterations of $digest error (which makes sense).
How do I shut it off pletely?
EDIT
Unfortunately rethrowing the error doesn't solve the issue - IE only knows the error from the rethrow and not from source.
I don't want $exceptionHandler to handle any exceptions - I want them to propegate up to the browser (primarily for IE testing in Visual Studio).
I'd tried overriding $exceptionHandler and simply rethrowing the error, which gives me the 10 iterations of $digest error (which makes sense).
How do I shut it off pletely?
EDIT
Unfortunately rethrowing the error doesn't solve the issue - IE only knows the error from the rethrow and not from source.
Share Improve this question edited Sep 13, 2013 at 15:21 Roy Truelove asked Sep 12, 2013 at 21:19 Roy TrueloveRoy Truelove 22.5k21 gold badges115 silver badges154 bronze badges 1- Was your overridden $exceptionHandler similar to the one provided in ngMock? – Problematic Commented Sep 12, 2013 at 21:30
3 Answers
Reset to default 8After some research, this isn't possible. Angular catches their errors and then calls the exception handler explicitly - in many cases it does not just let the error propagate.
According to the documentation, it's possible:
angular.module('exceptionOverride', []).factory('$exceptionHandler', function () {
return function (exception, cause) {
exception.message += ' (caused by "' + cause + '")';
throw exception;
};
});
This example will override the normal action of $exceptionHandler, to make angular exceptions fail hard when they happen, instead of just logging to the console.
Try throwing the exception inside a window.setTimeout
(not $timeout
) delayed execution, this would allow you to escape the $digest
black hole. But not sure it will preserve the stack-trace in IE.
本文标签: javascriptAngularJSDisable exceptionHandlerStack Overflow
版权声明:本文标题:javascript - AngularJS - Disable $exceptionHandler - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741250251a2365656.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论