1. Home
  2. Integrations
  3. Throw Exception

Throw Exception

Learn how to use EIPs

The Throw Exception EIP throws exceptions during message processing, offering greater control over the integration flow. With it, you can interrupt execution in specific scenarios, handle failures in a customized way, and ensure the expected behavior of processes.

When throwing an exception with Throw Exception, the integration flow is immediately interrupted, and the following steps stop being executed until the exception is handled or caught.

All exceptions generated by this component are recorded in the Analytics logs, allowing the user to easily monitor errors and failures that occurred during flow execution.

Configuring the Throw Exception EIP in the Diagram

To configure a Throw Exception in an integration in the Diagram tab, follow these steps:

Click +Add Step on the canvas.

Select the EIPs tab.

Select the Throw Exception EIP. You can use the search tool to locate it.

Fill in the following fields:

  • Message: custom message that will be associated with the exception.

  • Exception Type: specific type of exception to be thrown.

    Check frequently used exceptions:

    Exception Type
    Description
    java.lang.IllegalArgumentExceptionInvalid parameter
    java.lang.NullPointerExceptionUnexpected null value
    java.lang.RuntimeExceptionGeneric runtime exception
    java.io.IOExceptionIO problems, such as file or network failure
    javax.validation.ValidationExceptionData validation failure
    java.lang.UnsupportedOperationExceptionUnsupported operation

Example

Check below an example of configuring the Throw Exception EIP:

The flow is initiated by a GET request.

The first step in the flow logs a message: "Starting the flow. An exception will be thrown now." This serves as a monitoring point to indicate that the flow has been started and an exception will be thrown next.

The throw-exception EIP is triggered, and an IllegalArgumentException type exception is thrown, with the message: "Exception intentionally thrown by the throw-exception EIP".

In practice, the client will receive an HTTP error (probably 500 Internal Server Error) with the exception message, depending on your runtime configuration.

How happy are you with this page?

We use cookies to enhance your experience on our site. By continuing to browse, you agree to our use of cookies.Learn more