Recently, I've started investigating JavaScript's exception handling techniques. And apparently, JavaScript doesn't have a great model. JS's try{...}catch(error){...} functionality is pretty good. But where is the fallback technique for code outside of try...catch?
IE and Firefox both support window.onerror(msg, url, line). But what about Safari and Opera?
When you use try...catch, each browser returns a slightly different Error object.
Has anyone else tried to cope with this issue?
Personally, I'd love to see Ext expose a technique for catching any and all exceptions throw within Ext's code base. I know that's a tall order (since Ext's code base is already so large), but I think it could be pretty simple.
Perhaps a new 'global' event: Ext.onerror(Object this, Ext.Error err)
harley.333: I just learned yesterday about window.onerror at The Ajax Experience. As you point out, the only downside is not supporting Safari and Opera. So, I agree that modifying Ext to provide a global error handler would be great.
Yes, I agree, I would like to see in Sencha a way to centralized exceptions and then later We can write a log file with all of this exceptions and send it to a server.
This would be very helpful in Sencha Touch when We use it in native apps. The mobile device can report when something crash.