3 Replies Latest reply on Jul 17, 2008 10:20 AM by Admiral_Brodnack

    Global Exception Handling

    Level 1
      Is there someway to setup a global exception handler?

      For example create a listener for any unhandled exception for the entire AIR application. You could set it on the main WindowedApplication component for the application. Is there a way to do this?
        • 1. Re: Global Exception Handling
          Oliver Goldman Adobe Employee
          No, there is not. We're considering this for a future release.

          • 2. Re: Global Exception Handling
            Level 1
            This is a huge problem with AIR applications. I hope this is fixed soon.

            Exceptions can be thrown and unless you have everything single line of your code in try / catch blocks these exceptions can go unnoticed when using the non-debug version of the runtime.

            Developers need to be able to catch these exceptions and handle them properly.
            • 3. Re: Global Exception Handling
              Admiral_Brodnack Level 1
              "Developers need to be able to catch these exceptions and handle them properly."

              In general, wouldn't it be too late to handle an exception at the global level? At best, you could just display and log the error. E.g. if the user tries to load a non-existent file, then the file loading code should handle the exception, possibly prompting the user to choose an existing file. If you caught this exception at the global level, what could you do about it?

              So it seems to me, putting try/catch blocks around exceptions I can deal with is necessary anyway. A global handler would be a small improvement, but only in that it makes it easier to identify bugs in the release version that I missed in testing my app.