catching errors from remotely invoked processes
Ok, you know how sometimes the flash runtime throws an error in a popup window
with a stack trace that and let's you click 'dismiss' or 'cancel'. I need to
do something like that. My flex app gets invoked from a java process so I
can't use the debugger and trace statements. But the program is crashing and I
need to figure out why.
The program is receiving some arraycollections and needs to append those to
the arraycollections which are set up during initialization. These
arraycollections are data providers for some charts. I have to do everything
in actionscript. I set up the data binding like this.
BindingUtils.bindProperty(lineSeries, "dataProvider", ser, "pointList");
Here is the way I'm currently trying to append the new data and catch the
error, but this does not work.
try {
for (var i:int = 0; i<newArray.length; i++) {
oldArray.addItem(newArray.getItemAt(i));
}
} catch (err:Error) {
// code to react to the error
var errorMessage:TextField = new TextField();
errorMessage.autoSize = TextFieldAutoSize.LEFT;
errorMessage.textColor = 0xFF0000;
errorMessage.text = err.message;
addChild(errorMessage);
}
|