Throw Error

Know the component and how to use it.

Micaella Mazoni avatar
Written by Micaella Mazoni
Updated over a week ago

IMPORTANT: This documentation has been discontinued. Read the updated Throw Error documentation on our new documentation portal.

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 Code: defines the code of the error (we use it based on HTTP errors code).

  • Error Message: defines the error message that goes with the error code.

  • Custom Error Enabled: defines that the user wants to use a custom error.

  • Custom Error: can be used to define a custom error message (in this case, “Error Code” and “Error Message” are ignored).

  • Fail on Error: if the option is enabled, the execution of the pipeline with error will be interrupted; otherwise, the pipeline execution proceeds, but the result will show a false value for the “success” property.

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 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": <um número longo informando o timestamp de quando o erro foi gerado>,
"error": <a mensagem configurada>,
"exception": "PipelineEngineRuntimeException",
"code": <o código configurado>
}

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” option is filled, then the content of the JSON object is the same as the one described in the "Use of Throw Error to treat standard errors" or "Use of Throw Error to treat custom errors" sections.

To better understand the concept of subpipelines, click here.

Did this answer your question?