PDA

View Full Version : [CLOSED] Ui goes Kaboom on exception



ritcoder
1 Mar 2012, 12:13 AM
Hi,
I've noticed that the entire layout of Ext is rendered unusable if an exception is thrown when generating a component and an exception occurs. One example of a kaboom is that in that state, when you create a window and try showing it, it simply pushes whatever is there up and shows itself below:

Some test code


//new JSPad page
var testKaboom = function(kaboom){
if (kaboom){
var win = Ext.create('Ext.window.Window',{width:500,height:500,
listeners: {
afterrender: function(){
throw 'kaboom';
}
}
});
return win;
}else{
var win = Ext.create('Ext.window.Window',{width:500,height:500,
listeners: {
afterrender: function(){
//throw 'kaboom';
}
}
});
win.show();
}
}

var w;
try{
w = testKaboom(true);
w.show();
}catch(e){} //just ignore this error
w=testKaboom(false);
w.show();


After this error, nothing else renders correctly.
Has the same thing whenever a dom exception is thrown as a result of tab animation and funny enough I think when a dock value is wrong but I'll confirm that.



32258

regards.

mitchellsimoens
1 Mar 2012, 2:39 PM
What would you have us do?

ritcoder
1 Mar 2012, 3:02 PM
Well, I would expect the error to be caught and thrown if need be but not destroying the entire ui as a result.
I meant it is better to have a form panel with missing fields or a window with missing components which the client can report like 'hey, the first name is not showing but the other window opens' instead of a completely messed up ui. A developer can for example, subscribe to some onSomeExceptionEvent if he is interested in those events. They could even be filtered by exception types, etc, etc.

mitchellsimoens
1 Mar 2012, 3:07 PM
Unit and integration testing should alleviate the errors you would have in your app.

evant
1 Mar 2012, 3:08 PM
The whole point of throwing an exception is that it's an exceptional case that it cannot recover from.

Certainly, if there's some particular condition that generates an exception when it shouldn't could be considered a bug, but just generally saying ~all~ exceptions need to be caught isn't something we can do.

ritcoder
1 Mar 2012, 11:24 PM
Certainly not the response I was looking for. Most of the errors that caused the ui to crash were Extjs errors. I could not reproduce them that is why I wrote that sample

evant
2 Mar 2012, 2:41 PM
Right, so if there's a specific case that causes an exception, then that particular case should be fixed. Just wrapping everything in a try/catch block is not a solution.