
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Limitations of Exception Handling in ActionScript 2.0
|
277
Last, Example 10-4 shows a return statement in a finally block. In this case, the return
statement executes when the finally block executes (as we learned earlier, a finally
block executes when its corresponding try block completes in one of the following
ways: without errors, with an error that was caught, with an error that was not
caught, or due to a return, break,orcontinue statement). Notice that the return state-
ment in Example 10-4 prevents any code in the method beyond the try/catch/finally
statement from executing. You might use a similar technique to quit out of a method
after invoking a block of code, whether or not that code throws an exception. In such
a case, you’d typically surround the entire try/catch/finally block in a conditional
statement (otherwise the remainder of the method would never execute!).
If a return statement occurs in a finally block after a return has already been issued in
the corresponding try block, then the return in the finally block replaces the return
already in progress.
Limitations of Exception Handling
in ActionScript 2.0
As you use exceptions in your code, you should be aware of the following exception-
handling limitations in ActionScript 2.0.
No Checked Exceptions
In ActionScript