![](/img/trans.png)
[英]How do I populate the 'cause' parameter of $exceptionHandler?
[英]When implementing a custom $exceptionHandler in angularJS, how do I preserve default log?
我正在使用自定义angularJS $exceptionHandler
(将客户端异常发送到我的服务器):
app.factory('$exceptionHandler', function() {
return function(exception, cause) {
//custom handling of the exception
//...
};
});
如何保留默认控制台日志?
可以使用$log
保留默认$log
:
app.factory('$exceptionHandler', ['$log', function($log) {
return function(exception, cause) {
//custom handling of the exception
//...
$log.error.apply($log, arguments);
};
}]);
有关此博客文章的更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.