Raise Error
raise_error · Nodes · Control
Fails on purpose with an error a node sent to its error output.
Raise Error#
Fails on purpose with an error a step sent to its error output.
A step set to Route to error output does not fail the run when it fails: its error goes out on its error output as a value, and its other outputs end their branches. Raise Error turns that value back into a failure. Use it when a failure was handled (logged, reported, a fallback tried) but should still fail the run, ideally with a clearer message.
Inputs & Outputs#
- Input:
error(required) - the error value from a step'serroroutput:{ node_id, node_type, message, causes }. - Outputs: none. Raise Error always ends its branch, and it never succeeds.
Config#
message- what failed, in the workflow's own terms, for exampleCould not refresh the price list. Empty by default; when empty, the message isthe error from node '<node_id>' was raised again, naming the step the error came from.
Behavior#
- The node always fails. Its error is the configured message, and under it, in order, the step the error came from with its message (
node '<node_id>' (<node_type>): <message>) and then each of that error's causes. The run history shows these under Caused by, so nothing about the original failure is lost. - Its own failure mode decides what the failure does, as for any step:
- Stop branch (default): the run fails, with Raise Error as the step it failed on.
- Fail workflow: the whole run stops at once, including independent branches.
- Route to error output: the error goes out on Raise Error's own
erroroutput, wrapped in the new message. Itscauseslist every link of the raised chain, so raising again any number of times keeps the original cause.
- Given a value that is not an error value, such as an object built by hand, the node fails with the configured message, or
Raise Error was given a value that is not a node errorwhen none is set.
Example#
An HTTP Request step fetch_prices, set to Route to error output, has its error wired to a step that posts the failure to a channel, and also to Raise Error with message set to Could not refresh the price list. When the request fails, the failure is posted and the run still fails. Its history reads like this, with the request's own error in the last line:
Could not refresh the price list
Caused by:
0: node 'fetch_prices' (http_request): request failed with status 503
To recover from a failure instead of raising it, wire error into a JavaScript step that returns the fallback value, and that step's output into the same input the failing step's output feeds.
Related Nodes#
- If - routes on a condition, the way Route to error output routes on a failure
Inputs
errorRequired
Outputs
None.
Configuration
| Field | Type | Required | Description |
|---|---|---|---|
message | string | No | What failed, in the workflow's own terms, for example: Could not refresh the price list. Leave empty to name the node the error came from. |
base_config | record | No | Shared node configuration. failure_mode decides what a failure of this node does to the workflow; leave it at the default stop unless the workflow handles the failure itself on the node's error output (route_to_error) or the node is a rare emergency kill switch (stop_workflow). |