admin管理员组文章数量:1434972
Is there a way to handle all JavaScript errors and exceptions in ExtJS application globally and route it to a function that alerts the user on a server error?
window:onerror()
doesn't seem to handle all the JavaScript errors, hence looking for some kind of catch in the code, to wrap it in to a more generic exception so that it would be caught?
Is there a way to handle all JavaScript errors and exceptions in ExtJS application globally and route it to a function that alerts the user on a server error?
window:onerror()
doesn't seem to handle all the JavaScript errors, hence looking for some kind of catch in the code, to wrap it in to a more generic exception so that it would be caught?
1 Answer
Reset to default 3See
http://docs.sencha./extjs/4.2.1/#!/api/Ext.Error-static-method-handle
Globally handle any Ext errors that may be raised, optionally providing custom logic to handle different errors individually. Return true from the function to bypass throwing the error to the browser, otherwise the error will be thrown and execution will halt.
Example usage:
Ext.Error.handle = function(err) {
if (err.someProperty == 'NotReallyAnError') {
// maybe log something to the application here if applicable
return true;
}
// any non-true return value (including none) will cause the error to be thrown
}
Normally an error would get handled by onerror, but returning true in Ext.Error.handle prevents that.
Also look at http://docs.sencha./extjs/4.2.1/#!/api/Ext.Ajax-event-requestexception
本文标签: javascriptGlobal error handling in ExtJSStack Overflow
版权声明:本文标题:javascript - Global error handling in ExtJS - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745631041a2667274.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论