Flex UncaughtErrorEvent in non-debug flashplayer

// April 27th, 2012 // Hardware

Flashplayer 10.1 and AIR 2.0 come with very nice feature enabled – global error handling.
Here is the official Adobe announce about this:

Update 2010-01-12: Global error handling is now supported in Flash 10.1 and AIR 2.0 (both in beta), and is achieved by subscribing the UNCAUGHT_ERROR event of LoaderInfo.uncaughtErrorEvents.

Anyway, this is very useful especially when you run debug version of flash player.

But what is happening if you are using the regular non-debug flash player ?

Then simply the stack trace does not appear. Here Is example of demo code which globally handles errors in flex application:

In Application.mxml applicationComplete event handler:

loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, uncaughtErrorHandler);

And here is the handle method:

private function uncaughtErrorHandler(event:UncaughtErrorEvent):void {
var error:* = event.error;
if (error is Error) {

var errorObj:Error = error as Error;
LOG.error(“{0}. {1}\n {2}”, errorObj.errorID, errorObj.message, errorObj.getStackTrace());

} else if (error is ErrorEvent) {

var errorObj2:ErrorEvent = error as ErrorEvent;
LOG.error(“{0}”, errorObj2.text);


If you check out the result of this code ran in non-debug flashplayer version, you will notice that only “Error #1009″ is printed.
It would be nice if adobe store at least the target class in the ErrorEvent object, so we can see when regular users are having runtime errors and then can send the error to our support engineers.

Leave a Reply