Flex/Flash/Actionscript

How are you doing global exception handling in Flex/Flash/AS3?

On the project I’m currently working I was recently assigned the following bug:

runtime errors hose application
It seems that when a RTE encountered, the app is pretty much hosed (somewhat unpredictably) until the app is reloaded.

Since non debug players simply swallow the error without any other action, I assume users of the nondebug player who encounter RTEs will report odd behavior with is more of an effect that a cause.

Is there anything we can do to handle this any better?

This is a well known issue with Flash Player. There’s no global exception handling. It’s the most voted on issue in the Flash Player bug database (https://bugs.adobe.com/jira/browse/FP-444). It’s duplicated within the Adobe bug database a few times, and even one of the duplicates is the second most voted on bug in the AS Compiler bug database (https://bugs.adobe.com/jira/browse/ASC-3139). Combine those votes and you’ve got by far the single most wanted feature in Flash Player.

My initial response to this issue was to just say it’s impossible given the current state of Flash Player. But then I got thinking about possible solutions.

What about using JavaScript?
So let’s say I’m resigned to the fact that I cannot have any kind of global exception handling. What if I set up a simple pingback function in my Flash application that was called with JavaScript through ExternalInterface? The only purpose of this function would be to notify the HTML wrapper that the application is responding. Basically the HTML pages says “Yo Flash, you alive?” and Flash says “Yup, still pinging!”

Then if you ever don’t get a ping back you know that something is seriously wrong. Like, application-is-totally-hosed type of seriously wrong. You could then at least display a big ugly crash screen overlay on top of your app and give the user a little description field to file a bug report to tell you what they were doing when the app broke. You wouldn’t be able to save the app from breaking, but you would at least tell the user that the app is broken (which is much better than letting them keep trying to use a broken application) and you might get valuable bug reports to help you find the issue.

So here’s my big question:

In your experience with Flash applications and runtime errors that cause the application to stop functioning correctly, would a simple pingback function of the main application:

  • A. continue to run after the RTE (since the pingback function is so simple, doesn’t do any Flash rendering, or for whatever other reason)
  • B. always stop running after a RTE
  • C. sometimes keep running and sometimes stop running depending on the type of RTE

I have a feeling that the answer is C, which is half useless (although might be better than nothing). But if you know for a fact that you can write some kind of function that will always stop running after ANY runtime error in your application, please let me know (maybe this could include checking something in one of the Flex manager classes? verifying your main application is still laying itself out to the right dimensions? still able to add and remove a simple item from the stage?).

Yes, I am crowdsourcing my bugs.

Standard