javascript - Global error handling in ExtJS - Stack Overflow

Is there a way to handle all JavaScript errors and exceptions in ExtJS application globally and route i

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?

Share Improve this question edited Jul 26, 2013 at 19:32 drvdijk 5,5542 gold badges31 silver badges48 bronze badges asked Jul 26, 2013 at 18:40 John JaiJohn Jai 3,7337 gold badges26 silver badges35 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

See

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745631042a4637109.html

相关推荐

  • javascript - Global error handling in ExtJS - Stack Overflow

    Is there a way to handle all JavaScript errors and exceptions in ExtJS application globally and route i

    4小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信