Language Guide

CHAPTER 7
Control Statements
Try Statements 207
The error handler can include up to five parameter variables (also called
formal parameters) that represent the actual information sent in the error
message when the error occurs. When the error handler is called, the parameter
variables become local variables in the error handler.
Try 7
A Try statement is a compound statement consisting of a list of AppleScript
statements followed by an error handler to be executed if any of the statements
cause an error message.
SYNTAX
try
[ statement ]...
on error ¬
[ errorMessageVariable ] ¬
[ number errorNumberVariable ] ¬
[ from offendingObjectVariable ] ¬
[ partial result resultListVariable ] ¬
[ to expectedTypeVariable ]
[ global variable [, variable ]...]
[ local variable [, variable ]...]
[ statement ]...
end [ error | try ]
where
statement is any AppleScript statement.
errorMessageVariable (an identifier) is a parameter variable for the expression,
usually a string, that describes the error. You use this parameter variable to
refer to the error expression within the error handler.
errorNumberVariable (an identifier) is a parameter variable for the error number
(an integer). You use this parameter variable to refer to the error number within
the error handler.