Automation Engine Script Guide > Introduction > Advanced Users > Error Handling

 Error Handling

Note that errors might occur when AE Scripts are written. Take reasonable precautions is therefore highly recommended.

Creating a script

A possible source of error already lies in the creation of a script. Therefore, the syntax of the applied script functions and statements is checked whenever the object is stored. An error message is displayed if too many/few parameters were used, for example. The error message also contains the line number in which the error occurred.

Only the syntax of the script is checked. The specification of correct values (e.g. object names), however, is entirely in your hands.

Using return codes

Return codes of functions inform about the results of script functions. The documentation about script elements also includes the return codes that can be supplied for each script element for further evaluation.

Using :ON_ERROR

An error message is displayed and the script is canceled if an error occurs during the execution of a script. This, however, does not apply to all script elements. :ON_ERROR can be used then in order to determine whether a script should be canceled or not. If not, the error message can be accessed with the special script functions SYS_LAST_ERR_NR and SYS_LAST_ERR_INS.