:SET_LAST_ERR

Script Statement: Sets error number and text

Syntax

:SET_LAST_ERR Number[, Insert]

Syntax

Description/Format

Number

Error number
Format: Number, script variable or script function

Insert

Error text, variable part of the error message
Format: script literal, script variable or script function

This script statement :SET_LAST_ERR sets error number and text. This statement overwrites error numbers and/or the variable part of the preceding error message. The specification of Insert is optional. If Insert is not specified, the variable part of the error message is an empty string.

Be careful to specify a valid error number. A list of all available messages including their texts is found in the message manual.

A message can be composed of several parts. Separate these parts with a "|". Their order can also be seen from the message manual.

Error numbers and text can be deleted with :SET_LAST_ERR 0.

Tips:

  • You can delete error numbers and text with the following script statement: :SET_LAST_ERR 0. For more information, see :SET_LAST_ERR.
  • You can retrieve the complete modified error message. For more information, see GET_MSG_TXT.

Example

In the example shown below, error number "20657" is set with the 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.

The result of the script statement is:

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

See also: