1. Tasks
  2. Throw Error

Tasks

Throw Error

Forcibly fail an action with a custom error message when specified conditions are met.

It is important to note that an error is thrown and the action fails when a condition inside of throw_error_conditions is true. This differs from normal task conditions, where tasks run only when all conditions inside the task conditions are true.

When this task throws an error, the action will fail, and a _log_failed_action feedback action will run. The details of forced failure can be found in the data of the _log_failed_action.

Basic usage

Stop an action by throwing an error when the checked value is not true.

loading...

Parameters

throw_error_conditions
required
array

A list of conditions. If any of these conditions evaluate to to true, the task will forcibly fail the action.

Default: None, task will fail if not provided.


error_message
optional
string

The error message to include to the _log_failed_action data. This can help to identify which throw_error task threw the error, or to investigate some state at the time of the error. For example:

"The number tried for whatsapp was: {{stub.data.customer_number}}"

Default: Default message. No error message provided.

Result

A _log_failed_action with the following stubpost data:

loading...

Properties

error_response

The full error response, present in any _log_failed_action with all the details about the error.


throw_error

A section of the full error response with all details about the throw_error task that threw the error. It is pulled out of the full error for better visibility.