AppleScript generates two kinds of error — compile errors and runtime errors. Script Debugger displays full information about where the error occurred and what went wrong.
If your script catches (handles) a runtime error with a try block, the error does not percolate up to AppleScript and it is not reported back to Script Debugger. In effect, there is no error.
In debug mode, however, you can break on an error even if it is caught.
Error information is displayed in a dialog. The structure of the dialog reflects the structure of the error message received from AppleScript.
An error message received from AppleScript can contain up to six parts, corresponding to the five parameters of the AppleScript error
command plus there an Application parameter supplied by AppleScript itself. These are displayed in the dialog as follows:
The panes of the error dialog are explorers. If the value displayed in a pane is an object reference, Best view is an outliner, and individual lines can be double-clicked to create a separate explorer window.
To show the error message dialog again after dismissing it:
Choose Script > Show Last Error.
Or, click on the error location marker (the arrow in the gutter).
After an error dialog is dismissed, the script is marked in three ways:
An arrow in the gutter shows the line in which the error occured.
You can click this arrow to display the error message dialog after dismissing the dialog.
The line is highlighted, and the troublesome words are selected.
The error message string is displayed in the status bar (if no other status message has come along to replace it).
For information about a special kind of error situation where a file or transaction is left open, read on.
|