Tutorial by Examples

Error handling in AppleScript uses try on error. The code which may throw an error goes in the try block and any error handling code is in the on error block. The on error block is closed using end try. foo is not defined, so throws an error. When an error occurs, the dialog is displayed. try ...
You can throw your own errors using error. Execution stops at uncaught errors. By default, the error message is "An error has occurred." with error number -2700. error error "An error has occurred." number -2700 from «script» to item You can pass a message with the error...

Page 1 of 1