# Custom Error Handling

## Overview

With custom error handling [⚠️](https://emojipedia.org/warning/) you can set **how an error should be handled on a per-connector basis** in order to prevent flows from being terminated for small errors, but also handling crucial errors accordingly.

You can **set error handling on each connector** of a flow by opening it and clicking the edit button next to its name, where you find a dropdown with the available options:

<figure><img src="https://291121471-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-McrRFZHYH27bqKzOVDd%2Fuploads%2FRpHJSILJwbDzFa5w8bOA%2Fimage.png?alt=media&#x26;token=9f2bea92-4545-4742-9fb6-d2d060fa7b36" alt="" width="563"><figcaption></figcaption></figure>

## Error handling options

There are five options how to handle errors on each Connector and Helper node of a flow:

### 1. Terminate flow

Terminating the **entire flow** upon an error is the default option, the connector which caused the error will get the status `error`, just as the flow itself.

### 2. Continue flow

The flow continues with the **next flow step** as if there wasn't an error. The flow step with the error gets the status `error`, the flow itself has the status `success`. This is helpful if you e.g. loop over hundreds of records and don't want to stop the whole flow due to one error.

{% hint style="warning" %}
**Continue flow** cannot be used in the last step of a loop. In this case, use **Skip loop iteration** in the last step of the loop instead.
{% endhint %}

{% hint style="warning" %}
**Continue flow** should not be used in the [Boolean](https://docs.locoia.com/connectors/helpers/boolean-helper) and [Multi Case Helper](https://docs.locoia.com/connectors/helpers/multi-case-helper), as an error will not produce one of the outputs written on the arrows and thus the flow will get stuck at that particular point.
{% endhint %}

### 3. Skip loop iteration

The current loop **iteration is skipped** and the next iteration of that loop is started (i.e. the next 'item' of the list the looper is looping over).\
There is **no output saved** for the loop iteration with the error in the loop itself in order to use the content of the loop in further steps, as if the error didn't happen.\
The steps that happened inside the loop are shown in the flow debugger and the flow step with the error gets the status `error`.\
In case the looper is a while loop, which has input from the flow step that failed for the while condition, the looper would fail as well, which is then handled as specified in the looper.

### 4. Break current loop

The (current) loop where the flow step failed is broken, which means that the inner-most loop (based on the position of the error) is terminated and the flow continues as it would if the loop was finished. In the next flow iteration of the loop around it, the loop will be executed again as usual. This could either be the next step after the loop, or if the loop is nested, the loop around the loop where the flow step failed.

The failed flow step and the current loop get the status `error`.

### **5. Manual** handling

When you select **Manual handling**, another [arrow](https://docs.locoia.com/connectors/helpers/error-arrow) with the label **Error** is added to the corresponding connector.

<figure><img src="https://291121471-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-McrRFZHYH27bqKzOVDd%2Fuploads%2FDspc1ySZPd8w2XC6ZHcF%2Fimage.png?alt=media&#x26;token=05d090e4-0e7e-4b76-8e60-85677697d2ae" alt="" width="563"><figcaption><p>Error handling arrow - nice word play!</p></figcaption></figure>

In case of an error in that connector, the path with the error label will be executed (this could e.g. be reconnected to the standard flow).
