:ON_ERROR

The :ON_ERROR script statement determines what happens to script processing when a script element returns a particular error or message. Use keywords with the :ON_ERROR statement to continue script processing when an error occurs, thereby allowing you to read return codes, or to cancel the script. For more information on script functions that you can use to analyze errors, see Script Elements for Error Handling.

Note: Some script elements allow you to directly define error behavior without requiring an :ON_ERROR statement.

Syntax

:ON_ERROR Reaction

Parameters

Note: You can use :ON_ERROR to define error handling when using the following

You can also use :ON_ERROR to include error handling in scripts with arrays that use an invalid index. For more information, see Arrays.

By default, the Automation Engine continues processing scripts that contain these script functions when an error occurs.

Example

The following example specifies that script processing continues in the event of an error. The system checks the capacity of a drive, and retrieves the error number and error message.

:ON_ERROR RESUME
:
SET &CHECK# = GET_FILESYSTEM('WIN21', 'Z:\', FILESYSTEM_SPACE_TOTAL)
:
SET &ERRNR# = SYS_LAST_ERR_NR
:
SET &ERRINS# = SYS_LAST_ERR_INS
:
SET &MESSAGE# = GET_MSG_TXT (&ERRNR#,&ERRINS#)

See also:

seealso

Error Handling in Scripts

Notification (CALL)

User Return Codes of Executable Objects

System Return Codes of Executable Objects

Script Elements for Error Handling