5 Replies Latest reply on Jan 18, 2013 2:24 PM by Flex harUI

    Flex bug in global error handling

    RichBelaK

      My application's global error handler (uncaught error handler) works mostly, but I found a case where it doesn't work, but should.  Before I filed an official bug report I wanted to post the issue here.

       

      Here is the issue: in a module, ErrorEvents that are not listened for  and are dispatched by a Flex component are never caught in the application's uncaught error handler. 

       

      I have a sample project that demonstrates this.  Here is the module in my test case:

       

      <?xml version="1.0" encoding="utf-8"?>

      <s:Module xmlns:fx="http://ns.adobe.com/mxml/2009"

                   xmlns:s="library://ns.adobe.com/flex/spark"

                   xmlns:mx="library://ns.adobe.com/flex/mx">

      <fx:Script>

          <![CDATA[

              private function onClickSparkDispatch():void {

                  dispatchEvent( new ErrorEvent( ErrorEvent.ERROR, false, false, "test" ) );   // this isn't caught in the uncaught error handler

              }

              private function onClickNonSparkDispatch():void {

                  var nonSparkDispatcher:EventDispatcher = new EventDispatcher();

                  nonSparkDispatcher.dispatchEvent( new ErrorEvent( ErrorEvent.ERROR, false, false, "test" ) );  // this is caught in the uncaught error handler

              }   

          ]]>

      </fx:Script>   

          <s:HGroup>

              <s:Button label="Module Spark Dispatch (broken)" click="onClickSparkDispatch()" />

              <s:Button label="Module Non-Spark Dispatch" click="onClickNonSparkDispatch()" />

          </s:HGroup>

      </s:Module>

       

      Using Flex 4.6

      My application statically links in the Flex SDK ("merged into code" in Flash Builder).

      My applications works around these two exsiting bugs:

           https://bugs.adobe.com/jira/browse/SDK-28018

           http://blogs.adobe.com/aharui/2011/04/catching-uncaughterror-in-flex-modules.html

       

      Is this a bug?

       

      Thanks,

      Rick