
Writing Technician Interface Scripts
2-28
308660-14.00 Rev 00
on error
The
on error
command allows you to specify an error handler label within a script
file. If a command returns an error or if the user attempts to abort the script file,
the script interpreter goes to the error handler label defined in the file. If you press
Ctrl-c to abort the script, the Technician Interface displays the following prompt:
Terminate script file? (y/n):
Syntax
The
on error
command has the following syntax:
on error [-s] :
<label>
:
-s
allows the script to recover without returning an error message if the
on error
command cannot locate a specified file.
<label>
is the name of the error handler label.
Example
In the following script, the script interpreter goes to the label
:ERROR_HANDLER: when an error occurs:
on error :ERROR_HANDLER:
echo “what
echo “this line is skipped due to the above”
echo “syntax error. (Missing quote)”
:ERROR_HANDLER:
echo “The error handler is called because of the”
echo “deliberate syntax error in the previous command.”
The error handler is automatically canceled after an error is found or if you issue
the
on error
command without a label.
Commentaires sur ces manuels