Handling Synchronous Errors In An Application - Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual

Programming actionscript 3.0
Table of Contents

Advertisement

{
tf.text = error.toString();
}
If the
readBoolean()
the following message would be displayed in the
of file was encountered."
The same code in a release version of Flash Player would display the following text:
"EOFError: Error #2030."
In order to keep Flash Player's resources and size to a minimum in the release version, error
message strings are not present. You can look up the error number in the documentation (the
appendixes of the ActionScript 3.0 Language Reference) to correlate to an error message.
Alternatively, you can reproduce the error using the debugger version of Flash Player to see the
full message.
Handling synchronous errors in an
application
The most common error handling is synchronous error handling logic, where you insert
statments into your code to catch synchronous errors at run time. This type of error handling
lets your application notice and recover from run-time errors when functions fail. The logic
for catching a synchronous error includes
try an operation, catch any error response from Flash Player, and finally execute some other
operation to handle the failed operation.
Using try..catch..finally statements
When you work with synchronous run-time errors, use the
statements to catch errors. When a run-time error occurs, Flash Player throws an exception,
which means that Flash Player suspends normal execution and creates a special object of type
Error. The Error object is then thrown to the first available
The
statement encloses statements that have the potential to create errors. You always use
try
the
statement with a
catch
the
statement block, the
try
execute.
method threw an EOFError in the debugger version of Flash Player,
try..catch..finally
statement. If an error is detected in one of the statements in
try
statements that are attached to that
catch
text field: "EOFError: Error #2030: End
tf
statements, which literally
try..catch..finally
block.
catch

Handling synchronous errors in an application

statement will
try
261

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents