failSession
Throws an exception with an error message and fails the mapping.
Use the following syntax:
failSession(String errorMessage);
The following table describes the parameter:
Parameter | Parameter Type | Datatype | Description |
---|
errorMessage | Input | String | Error message string. |
Use the failSession method to end the mapping. Do not use the failSession method in a try/catch block on a code entry tab.
You can add the failSession method to the Java code on any code entry tab except the Imports and Functions tabs.
The following Java code shows how to test the input1 input port for a null value and fail the mapping if it is null:
if(isNull(”input1”)) {
failSession(“Cannot process a null value for port input1.”);
}