Add system excepthook in actionscript!

Imagine you’ve made a very huge flash application and many users will play with it every day.

Imagine they don’t have the flashplayer debug installed and at certain points they fall into undiscovered application bugs ( it’s impossible to have a real bug free application, we know this ).
Then, what happens? With the flashplayer debug installed you can see the traceback and you can also continue or dismiss the code execution. But without the debug player? The code will try to continue but probably at that point your application is broken and users will feel it more and more uncomfortable with it.
What I would like to have in flash, and probably you too, is a global system exception handling for those unhandled exception.
In this way you can both present the problem to your users and then also create a report system which will help you to improve and fix your own application!
Something like I did with SEPY years ago using the sys.excepthook of python:
When an exception is raised and uncaught, the interpreter calls sys.excepthook with three arguments, the exception class, exception instance, and a traceback object. In an interactive session this happens just before control is returned to the prompt; in a Python program this happens just before the program exits. The handling of such top-level exceptions can be customized by assigning another three-argument function to sys.excepthook.
  • Yeah, this sounds so good! I see this fitting perfectly for pre-release versions.
    A link to adobe bug base entry to give my vote?

  • The code execution behavior between the release and debugger players is the same. The only difference is the presence of the dialog in the debugger players (and the extra textual information displayed there in the error thrown/dispatched).
    A global exception handler is being considered:

  • Were actually talking about this just recently.. We came to the conclusion that in Flex, most of the code is probably executed from UIComponent or Application (not really sure), so it should be possible to modify these (as they are opensource) and add try/catch blocks and turn exceptions into events or call a callback or whatever.
    What do you think?

  • This would really help. I’d send all applications to my company log and then know if something’s broken. For example when I get a lot of specific errors, I know the client broke something in their URL and can tell them about it.

  • workaround here:

  • Flash Player 10.1 and global error handling

    Well, it seems that the upcoming flashplayer 10.1 (first half of 2010?) has been completely designed to fill the gap that the current flashplayer has with the smartphones world (multitouch, accelerometer, screen orientation, sleep mode, out-of-memory m…