Exception Handling Functions
When writing your data transformation scripts, you can use the following functions to handle error conditions:
EAIRaiseError
EAIRaiseErrorCode
EAIFormatMessage
EAIRaiseError() Method
This method raises a fatal error and terminates the script. The following table presents the parameters for this method.
Syntax
EAIRaiseError(msg [, formatParameters])
Parameter | Description |
---|---|
msg |
Error message text from the Data Mapping Engine. |
formatParameters |
Optional string arguments inserted in the return value in the positions specified by the positional arguments in the msg parameter. A maximum of nine format parameters are allowed. |
Usage
You can provide format parameters to format the message text. For details, see EAIFormatMessage() Method.
EAIRaiseErrorCode() Method
This method raises a fatal error, terminates the script, and returns an error symbol that it receives from the business service.
Syntax
EAIRaiseErrorCode(errorSymbol, msg)
Usage
You can use this function when you want to pass an error symbol to a workflow as an indication to branch on an exception. If you are not branching on the specific error code in your workflow, use EAIRaiseError instead.
EAIFormatMessage() Method
This method formats strings that have position-independent arguments. The following table presents the parameters for this method.
Syntax
EAIFormatMessage(msg [, formatParameters])
Parameter | Description |
---|---|
msg |
A string that contains positional arguments. The substitution operation replaces the percent sign followed by a digit with the corresponding format parameter. |
formatParameters |
Optional string arguments inserted in the return value in the positions specified by the positional arguments in the msg parameter. A maximum of nine format parameters are allowed. |
Returns
A string of the formatParameters argument values in the positions specified by the positional arguments included in the msg parameter.
Usage
You can use this function to generate messages from strings that are translated and whose positions have changed as a result of the translation.
Example
EAIFormatMessage("Data: '%2', '%3', '%1'", "A", "B", "C")
returns the string:
"Data: 'B', 'C', 'A'"