16 Replies Latest reply on Aug 10, 2012 10:43 AM by Flex harUI

    Global error handling

    Zolotoj Level 3

      Just curious: Has anyone successfully created a global error handler that would catch an error from any part of a real application based on Parsley, and on a few other well known frameworks?



        • 1. Re: Global error handling
          Flex harUI Adobe Employee

          Try the example in the doc and the one on my blog to see if they work for you.

          • 2. Re: Global error handling
            Zolotoj Level 3

            I have looked into your Catching UncaughtError in Flex Modules.

            I dont think my problem relates  to modules. Here is what not working for me. We use remoteobjects to comunicate with the server. When we call a service we provide a callback in case of an error. When  an error does occur on the server we are getting into this call back function which is a class that is not based on any visual object. I then generate the same test error which is not getting caught.

            • 3. Re: Global error handling
              Flex harUI Adobe Employee

              It might apply if you have multiple SWFs including RSLs involved.  Every loaderInfo needs to be listening in order to catch some errors.


              Are you saying it works from a service but not from your own code?  How are you generating the error in your code?

              • 4. Re: Global error handling
                Zolotoj Level 3

                We are using a single swf file.

                What I am saying that if I do this:

                var foo:String = null;


                in different parts of the apps. this erorr is getting caught. But in the callback function that is called upon a server error I am not seeing this error being caught.


                Here is more code:

                public function handle(e:RemoteServiceEvent):void


                                              var foo:String = null;



                this error is not getting caught.

                • 5. Re: Global error handling
                  Flex harUI Adobe Employee

                  I’m still unclear.  The error is not caught but the debugger player shows the error dialog?  Or nothing shows up?  What is on the call stack at the point of the error?

                  • 6. Re: Global error handling
                    Zolotoj Level 3

                    The error is caught by the debugger. It is not caught by the global error handler.

                    • 7. Re: Global error handling
                      Flex harUI Adobe Employee

                      And what is on the call stack?

                      • 8. Re: Global error handling
                        Zolotoj Level 3

                        Something like this:

                        TypeError: Error #1009: Cannot access a property or method of a null object reference.

                                  at stoneriver.manager.data.persist::baseErrorHandler/handle()[C:\workspace\LSCommons\src\sto neriver\manager\data\persist\baseErrorHandler.as:31]

                                  at stoneriver.manager.data.persist::LsBaseDataCommand/error()[C:\workspace\LSCommons\src\sto neriver\manager\data\persist\LsBaseDataCommand.as:50]

                                  at flash.events::EventDispatcher/dispatchEventFunction()

                                  at flash.events::EventDispatcher/dispatchEvent()

                                  at mx.rpc::AbstractService/dispatchEvent()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\A bstractService.as:333]

                                  at uicore.framework.remoting::RemoteObject/__onResult()[C:\workspace\IIPFramework\src\uicore \framework\remoting\RemoteObject.as:124]

                                  at flash.events::EventDispatcher/dispatchEventFunction()

                                  at flash.events::EventDispatcher/dispatchEvent()

                                  at mx.rpc::AbstractService/dispatchEvent()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\A bstractService.as:333]

                                  at mx.rpc::AbstractOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\AbstractOperation.as:254]

                                  at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:318]

                                  at mx.rpc::Responder/result()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\Responder.as:5 6]

                                  at mx.rpc::AsyncRequest/acknowledge()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\rpc\AsyncR equest.as:84]

                                  at NetConnectionMessageResponder/resultHandler()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx \messaging\channels\NetConnectionChannel.as:552]

                                  at mx.messaging::MessageResponder/result()[E:\dev\4.5.1\frameworks\projects\rpc\src\mx\messa ging\MessageResponder.as:235]

                        • 9. Re: Global error handling
                          Flex harUI Adobe Employee

                          Can you make a simple test case that reproduces the problem?

                          • 10. Re: Global error handling
                            Zolotoj Level 3

                            This code is not a working example but it does illustrate the problem a bit:

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

                            <applicationArea:ApplicationAreaBase xmlns:fx="http://ns.adobe.com/mxml/2009"









                                                <logging:GlobalExceptionHandler preventDefault="true" >





                                      <topbar:TopBar height="59"



                                      <s:HGroup width="100%" y="59"

                                                            height="100%" gap="0">

                                                <leftMenu:LeftNavigationMenu   hideEffect="Fade"









                                                <rootTab:rootTabContainer           id="rootTabContainer"






                            Errors generated in TopBar are not getting caught by my error handler.

                            I am really running out ideas ....

                            • 11. Re: Global error handling
                              Zolotoj Level 3

                              I think I have an idea. it looks like if components I am trying generating an error in sourrounded by Try .. Catch block which I can't possibly see because we are using Parsley and other frameworks then my error handler is not getting that. Is that a correct observation?



                              • 12. Re: Global error handling
                                Flex harUI Adobe Employee

                                If that were true, the Player’s error dialog would not show up.

                                • 13. Re: Global error handling
                                  Zolotoj Level 3

                                  And it does not.

                                  • 14. Re: Global error handling
                                    Flex harUI Adobe Employee

                                    Then that would be a reasonable explanation.  However, if I read over your prior post #6, my interpretation is that you are claiming that the dialog does show up.

                                    • 15. Re: Global error handling
                                      Zolotoj Level 3

                                      No, the dialog is not showing regardless whether it's caught or not.

                                      • 16. Re: Global error handling
                                        Flex harUI Adobe Employee

                                        Then yes, there is likely something else catching it.  Single-stepping will show you the catch if you have source for the catch.