Error Handling
Scripts report two types of errors: soft errors and fatal errors.
Soft Errors
Soft errors are reported in the log (all errors are displayed beginning with "!!!" so that they are easy to identify) and usually set a corresponding 'ERROR' variable to "true".
Scripts can either ignore these errors or use an IFTRUE or IFFALSE command to handle the error in appropriate way. An example of a soft error is a "goto" command where the objectname is not found in the database. In this case the FINDERROR variable would be set to "true".
Fatal errors cause a script to abort immediately and are triggered when critical errors occur.
It is important for script programmers to properly and carefully test scripts before they go into service and to include error checking, particular for numerical parameters that come from sources edited by humans, so they don't "bomb" in the middle of the night!
A fatal error can be responded to by setting the variable USEFATALERRORSCRIPT to "true" and also setting the variable FATALERRORSCRIPT to the name of the fatal error handling script.
An example fatal error script would do an orderly shutdown of an observatory (park scope, shut down all hardware, close dome, email operator, etc.).
The types of fatal errors are listed in the table below:
Error Type |
Description |
Syntax or other error |
There is an error in the syntax of a command. Includes wrong number of parameters, an invalid parameter (number out of range, etc), invalid variable |
Error opening sub-script |
A sub-script file could not be found or opened |
Too many parameters |
A script line has too many parameters |
Variable Error |
Error loading or saving a variable value. This is usually due to trying to assign a value to a read-only variable or the assigned value is invalid or out of range. |
Label Error |
Duplicate jump label found or to many jump labels |
Command Error |
Command not found |
Sub-script Error |
Too many sub-scripts are running |
Jump Error |
Script jump location is invalid |
Unhandled Application Error |
This means an error occurred that was not handled properly. Generally this should not happen and likely means there is a bug in ARAP! |