---
title: Throw Exception
description: Learn how to use EIPs
documentId: ipaas-eips-throw-exception
locale: en-US
---

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:

<Steps>
<Step>
Click **+Add Step** on the canvas.
</Step>
<Step>
Select the **EIPs** tab.
</Step>
<Step>
Select the **Throw Exception EIP**. You can use the search tool to locate it.
</Step>
<Step>
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.IllegalArgumentException | Invalid parameter |
  | java.lang.NullPointerException | Unexpected null value |
  | java.lang.RuntimeException | Generic runtime exception |
  | java.io.IOException | IO problems, such as file or network failure |
  | javax.validation.ValidationException | Data validation failure |
  | java.lang.UnsupportedOperationException | Unsupported operation |
</Step>
</Steps>

## Example

Check below an example of configuring the **Throw Exception** EIP:

![](https://creative-ball-51b3fc85c0.media.strapiapp.com/throw_exception_example_9f567ae67d.png)

```yaml
- from:
    uri: rest:get:/demo
    steps:
      - log:
          message: "Starting the flow. An exception will be thrown now."
      - throwException:
          message: Exception intentionally thrown by the EIP throw-exception
          exceptionType: java.lang.IllegalArgumentException
```

<Steps>
<Step>
The flow is initiated by a GET request.
</Step>
<Step>
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.
</Step>
<Step>
The `throw-exception` EIP is triggered, and an `IllegalArgumentException` type exception is thrown, with the message: "Exception intentionally thrown by the throw-exception EIP".
</Step>
<Step>
In practice, the client will receive an HTTP error (probably 500 Internal Server Error) with the exception message, depending on your *runtime* configuration.
</Step>
</Steps>
