I’m sure YOUR code is always perfect, that YOUR functions that expect strings only ever get passed strings and that
nothing every fails in YOUR world, in MY world, stuff happens..constantly, and when it does I’m pretty happy to have
something like Try Catch, if your unaware of TC, it’s a very handy thing indeed.
simply:
The try…catch…finally statement provides a way to handle some or all of the possible errors that may occur in a given
block of code, while still running code.
Consider the following simple example:
function myFunction():Void {
throw new Error(”Some error”);
}
try {
myFunction();
}
catch(errObject:Error) {
trace(errObject.message);
}
kind of a silly example, but it illustrates the concept, of course the ‘myFunction is going to throw the error every
time, and when it does the error is ‘caught’ by the catch portion of the the try command that called ‘myfunction’
—
For a much more detailed explaination — stop by Joey Lotts article on the subject.






