PDA

View Full Version : Can't catch errors on Ext.Element update, loadScripts = true



eztam
3 Nov 2011, 7:39 AM
Hi,
is there a possibility to catch/ignore errors produced by the Elements update function?

Simple dummy example:


var e = Ext.getBody().insertHtml('beforeEnd', '<div></div>', true);
e.update('<script>var a = undefinedVariable;</script>', true, function() {
console.log('callback');
});

The callback won't be called, because of the error in the given js code;
Wrapping a try catch around the update call has no effect.

Does anyone know the reason and/or the solution for this problem?


Thanks eztam!

mitchellsimoens
18 Nov 2011, 11:35 AM
I honestly don't think you can. You would have to override Ext.Element#update to do a check when it does the window.execScript or window.eval and do the capturing yourself.

eztam
21 Nov 2011, 4:30 AM
I honestly don't think you can. You would have to override Ext.Element#update to do a check when it does the window.execScript or window.eval and do the capturing yourself.
OK, Thank you.
I fixed my problem as you suggested and I'm pushing possible exceptions into an array which will be applied to the callback function.