Transformations > Java transformation API reference > failSession
  

failSession

Throws an exception with an error message and fails the session. Use failSession to terminate the session.
Use failSession in any section of the Java editor except Import Packages. Do not use failSession in a try/catch block in the Java editor.
Use the following syntax:
failSession(String errorMessage);
Argument
Data Type
Input/Output
Description
errorMessage
String
Input
Error message string.
Use the following Java code to test the input field input1 for a null value and fail the session if input1 is NULL:
if(isNull(”input1”)) {
     failSession(“Cannot process a null value for field input1.”);
}