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

GET_MSG_TXT

Script Function: Retrieves the message text of the last error.

Syntax

GET_MSG_TXT (Number, [Insert])

 

Syntax

Description/Format

Number

Error number.
Format: script variable or number

The 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,… SYS_LAST_ERR_NR also supplies the error number.

Insert

Variable part of the error message (text).
Format: script literal or script variableA placeholder for a value within a script.

The script function SYS_LAST_ERR_INS also supplies the variableIt stores or retrieves values dynamically at runtime. An individual Automation Engine object type. part of the error number.


Return codes

Message text of the last error.
" " - No error has occurred.

Description

In some script elements, you can use :ON_ERROR in order to have script processing continued even if an error occurs. The error message can be retrieved by using the script function GET_MSG_TXT in such a case.

The error number Number and the variable part Insert are the basis for retrieving the message text. You can previously retrieve the error number by using SYS_LAST_ERR_NR and the variable part of the error message by using SYS_LAST_ERR_INS. The script function GET_MSG_TXT uses this information and the error texts in order to compose the complete AE error message.

The parameter Insert is not required if the message text does not include variable parts such as in statusThis represents the condition of a task (such as active, blocked, generating). texts whose numbers can be read by using GET_STATISTIC_DETAIL.

Example

The following example checks the memory capacity of a non-existing drive which results in an error. The error number and the variable part of the error message are read. This information is used to retrieve the complete AE error message which is then sent to a userIn the Automation Engine, a user is an instance of a User object, and generally the user is a specific person who works with Automic products. The User object is assigned a user ID and then a set of access rights to various parts of the Automation Engine system and product suite. These access rights come in the form of Automation Engine authorizations and privileges, Decision user roles and EventBase rights and ARA web application object rights. You can manage all these centrally in the ECC user management functions. See also, Unified user management. as a message.

:SET &CHECK# = GET_FILESYSTEM("WIN21", "Z:\", FILESYSTEM_SPACE_TOTAL)
:
SET &ERRNR# = SYS_LAST_ERR_NR()
:
SET &ERRINS# = SYS_LAST_ERR_INS()
:
SET &MESSAGE# = GET_MSG_TXT(&ERRNR#,&ERRINS#)
:
SEND_MSG BU,BU,&MESSAGE#

The second example retrieves the text that informs about a taskAn executable object that is running. Tasks are also referred to as activities.'s status.

:SET &STATUS# = GET_STATISTIC_DETAIL(&RUNNR#, STATUS)
:
SET &TEXT# = GET_MSG_TXT(&STATUS#)
:
PRINT &TEXT#

The output could be as shown below:

ENDED_CANCEL - manually canceled.

 

See also:

Script element Description

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_NR

Returns the number of the last error.

Script Elements - Error Handling and Messages

Sample Collection:
Retrieving Error Message and Number

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