SYS_LAST_ERR_NR

Use the SYS_LAST_ERR_NR script function to retrieve the number of the last error.

Tip: You can include processing instructions in the script to define what happens when an error occurs. For more information, see :ON_ERROR. You can then use SYS_LAST_ERR_NR to retrieve the number of the last error for further processing.

Syntax

SYS_LAST_ERR_NR ()

Parameters

  • SYS_LAST_ERR_NR ()
    Returns the number of the last error

Return Codes

The script function returns the number of the last error and the value "0" if no error has occurred.

Example

The following example checks the memory of a hard drive. An error occurs if this hard drive does not exist or cannot be accessed. The corresponding error number and variable message part are read and the entire AE error message can be determined and sent to a user.

:SET &CHECK# = GET_FILESYSTEM("WIN21G", "Z:\", FILESYSTEM_SPACE_TOTAL)
:
SET &ERRNR# = SYS_LAST_ERR_NR()
:
IF &ERRNR# NE "0"
:   
SET &ERRINS#  = SYS_LAST_ERR_INS()
:   
SET &MESSAGE# = GET_MSG_TXT (&ERRNR#,&ERRINS#)
:   
SEND_MSG BU,BU, &MESSAGE#
:
ENDIF

See also: