Is it possible to prevent an AIR application from halting execution on minor errors?
AIR's error messages on runtime are very useful when developing and debugging an application, but the problem is that even on final production releases, errors halt the application as well.
Once an application has been compiled as final release (IPA or APK), errors should not halt an application. At least not simple errors such as a null variable.
For example, take this code:
import flash.text.TextField;
var tfTest:TextField = new TextField();
var appendedText:String = ' World';
tfTest.text = 'Hello';
tfTest.appendText(appendedText);
addChild(tfTest);
This just makes the sentence "Hello World" appear in the screen. But imagine if the contents of appendedString came from a server, and for some reason the server outputted "null" at some time. That would cause the application to halt. Why? Just the lack of a string shouldn't halt the application!
Try running this code:
import flash.text.TextField;
var tfTest:TextField = new TextField();
var appendedText:String = null;
tfTest.text = 'Hello';
tfTest.appendText(appendedText);
addChild(tfTest);
If appendedText is null, then AS3 execution will halt at the tfTest.appendText() call, so the text field won't be even added to stage.
Ideally, I think we should at least get the word "Hello", even if the other word is null. That's better than halting the app so we don't get ANYTHING AT ALL.
This is just a very simple example, but I hope you get the point. Why should the app halt for such a unimportant reason? It's just a text string! If it's null, then don't append anything and carry on with the app execution! Don't halt the execution of the entire app (which makes the app unusable) just for a null variable!
I know maybe someone will say that I should check all variables for null before using them, and I usually do that, but there's some instances where I maybe never thought about the possibility of a null value, or I simply forgot to check one of the many variables in my app. And it's very annoying to get that behaviour in an app which is in the App Store, because it can make an app look "crashed". And everything could have just been avoided if the app just kept executing despite that missing string.
If execution didn't halt, that missing string would have been a very minor bug (just some missing text) instead of a CRITICAL BUG WHICH MAKES THE APP NOT WORK AT ALL!
So as you can see, it makes a BIG difference.
Halting the app with an error message during development is useful, but it doesn't make sense to halt execution in a production app, where a halted app just annoys the user, who can't do anything about it and can't see the error message anyway.
I can understand halting on "fatal errors", but just appending a null string is hardly a fatal error!! That shouldn't stop executing the app.
So is it possible to have a less picky error system when an app is compiled as release so execution is not halted in unimportant errors?
