Links

Throw Error

Know the component and how to use it.
Throw Error throws an error inside a pipeline or subpipeline. It can be used to:
  • interrupt a pipeline with error
  • interrupt a component that uses subpipelines for processing
Take a look at the configuration parameters of this component:
  • Error Message: defines the error message that goes with the error code.
  • HTTP Status Code: defines the code of the error (we use it based on HTTP errors code).
  • Enable Custom Error: defines that the user wants to use a custom error.
  • Custom Error (JSON): can be used to define a custom error message (in this case, HTTP Status Code and Error Message are ignored).

Throw Error in Action

Treating standard errors (customErrorEnabled)

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

Throw Error can also be used to treat custom errors. In this case, a complete JSON object is informed in the component configuration e lately informed in the output of the error-resulting pipeline.
IMPORTANT: some triggers, such as REST, HTTP and HTTP File, need to receive a code and an error property in the pipeline output to prepare the return code of the HTTP call.

Components that use subpipelines

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" or "Treating custom errors" sections.
To better understand the concept, read the article Subpipelines.