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

: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, variableIt stores or retrieves values dynamically at runtime. An individual Automation Engine object type. part of the error message
Format: script literal, script variableA placeholder for a value within a script. or scriptA particular Automation Engine object type.functionPre-defined run book template in the Automation Engine. One single step only, e.g. Start Windows Service, Copy file,…

Comments

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 listShows entities in a grid view 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.

The complete modified error message can be retrieved with 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 objectAutomation Engine controlled activities and processes are structured in the form of objects. See also: Task '&01', line '&02'. Destination folderTop level entities such as Environment, Deployment Target, Activity, … are stored in folders. The permissions a user has on an entity depend on the permissions that are set on the folder for the entities. '&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:

Script element Description

SYS_LAST_ERR_INS

Supplies the variable message part of the error that has last occurred
SYS_LAST_ERR_NR Returns the number of the error that has last occurred
SYS_LAST_ERR_SYSTXT Retrieves the last-occurred error message from the operating system

Script Elements - Error Handling and Messages

About Scripts
Script Elements - Alphabetical Listing

Script Elements - Ordered by function

 


Automic Documentation - Tutorials - Automic Blog - Resources - Training & Services - Automic YouTube Channel - Download Center - Support

Copyright © 2016 Automic Software GmbH