Automation Engine Script Guide > Ordered by Function > Error Handling and Messages > SYS_LAST_ERR_NR

SYS_LAST_ERR_NR

Script Function: Returns the number of the last error

Syntax

SYS_LAST_ERR_NR()

Return codes

Error number of the last error
"0" - No error has occurred

Comments

Some script elements facilitate continued script processing in the case of occurring errors when:ON_ERROR is used. The error number can then be retrieved with this script function.

Example

The example shown below intends to check 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:

Script element Description

GET_MSG_TXT

Retrieves the message text of the last error

GET_MSG_TYPE

Retrieves the type of a message number

SYS_LAST_ERR_INS

Supplies the variable message part of the last error

SYS_LAST_ERR_SYSTXT

Retrieves the last error message of the OS

Script Elements - Error Handling and Messages

Sample Collection:
Retrieving Error Message and Number

About Scripts
Script Elements - Alphabetical Listing

Script Elements - Ordered by Function