:SET_LAST_ERR

Use the :SET_LAST_ERR script statement to set an error number and a text. This statement overwrites the error number and/or the variable part of the preceding error message. Make sure you specify a valid error number. The complete list of available messages including their texts in the message manual as part of the Automation Engine platform on docs.automic.com, or as part of the complete download package of Automic Automation that is available in our Download Center.

Tips:

  • Use :SET_LAST_ERR 0 to delete an error number and its text.
  • You can retrieve the complete modified error message. For more information, see GET_MSG_TXT

Syntax

:SET_LAST_ERR Number[, Insert]

Parameters

  • :SET_LAST_ERR
    Sets and error number and text

  • Number
    Error number
    Format: number, script variable or script function

  • Insert
    (Optional) Error text, variable part of the error message. If the message consists of several variable parts, you must separate them with a pipe (|) character. You can see the order of the variable parts in the message manual. If this parameter is not defined, the variable part of the error message is an empty string.
    Format: script literal, script variable or script function

Example

The following example sets the error number 20657 with two variable message parts:

:SET_LAST_ERR 20657,"MM.DAY|20||OBJECTS"
:
SET &ERRINS# = SYS_LAST_ERR_INS()
:
SET &ERRNR# = SYS_LAST_ERR_NR()
:
SET &MSG# = GET_MSG_TXT(&ERRNR#, &ERRINS#)
:
PRINT &MSG#

Extract from the message manual: 20657 - Runtime error in object '&01', line '&02'. Destination folder '&04' not found.

Result of the script statement:

U0020657 Runtime error in object 'MM.DAY', line '20'. Destination folder 'OBJECTS' not found.

See also: