# Throw Error

**Throw Error** throws an error inside a pipeline or subpipeline. It can be used to:

* interrupt a pipeline with an error.
* interrupt a component that uses subpipelines for processing.

## Parameters

Take a look at the configuration options for the component. Parameters supported by [Double Braces expressions](/documentation/connectors-and-triggers/double-braces/overview.md) are marked with `(DB)`.

<table data-full-width="true"><thead><tr><th>Parameter</th><th>Description</th><th>Default value</th><th>Data type</th></tr></thead><tbody><tr><td><strong>Error Message</strong></td><td>Defines the error message that goes with the error code.</td><td>N/A</td><td>String</td></tr><tr><td><strong>HTTP Status Code</strong></td><td>Defines the code of the error (we use it based on HTTP errors code).</td><td>500-Internal Server Error</td><td>Integer</td></tr><tr><td><strong>Enable Custom Error</strong></td><td>Defines that the user wants to use a custom error.</td><td>False</td><td>Boolean</td></tr><tr><td><strong>Custom Error (JSON)</strong></td><td>Can be used to define a custom error message (in this case, <strong>HTTP Status Code</strong> and <strong>Error Message</strong> are ignored).</td><td>N/A</td><td>String</td></tr></tbody></table>

## Throw Error in Action <a href="#throw-error-in-action" id="throw-error-in-action"></a>

### Treating standard errors (customErrorEnabled) <a href="#treating-standard-errors-customerrorenabled" id="treating-standard-errors-customerrorenabled"></a>

**Throw Error** can be used to treat standard errors. Standard errors are those that follow the definitions of the Digibee Integration Platform and that contain a code and a message.

When this type of error results in the pipeline interruption, then the following output is produced:

```
{
  "timestamp": <a long number informing the timestamp when the error was generated>,
  "error": <the configured message>,
  "exception": "PipelineEngineRuntimeException",
  "code": <the configured code>
}
```

### Treating custom errors <a href="#treating-custom-errors" id="treating-custom-errors"></a>

***Throw Error*** can also be used to treat custom errors. In this case, a complete JSON object is informed in the component configuration and lately informed in the output of the error-resulting pipeline.

{% hint style="info" %}
Some triggers, such as [**REST**](/documentation/connectors-and-triggers/triggers/web-protocols/rest.md), [**HTTP**](/documentation/connectors-and-triggers/triggers/web-protocols/http.md)**,** and [**HTTP File**](/documentation/connectors-and-triggers/triggers/web-protocols/http-file.md), need to receive a code and an error property in the pipeline output to prepare the return code of the HTTP call.
{% endhint %}

### Components that use subpipelines <a href="#components-that-use-subpipelines" id="components-that-use-subpipelines"></a>

When **Throw Error** is used in a component that uses the **onProcess** subpipeline, the configured error is informed as the input of the **onException** subpipeline. If the **Custom Error (JSON)** option is filled, then the content of the JSON object is the same as the one described in the [Treating standard errors](#treating-standard-errors-customerrorenabled) or [Treating custom errors](#treating-custom-errors) sections.

To better understand the concept, [read the article Subpipelines](/documentation/developer-guide/development-cycle/build-overview/pipelines/subpipelines.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digibee.com/documentation/connectors-and-triggers/connectors/tools/throw-error.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
