Throw
Controlled node
Overview
The Throw node is a control flow node designed for error handling and debugging workflows. When triggered, it immediately halts execution and throws an error with a custom message. This is useful for creating explicit failure points in your workflow, validating conditions, or debugging by forcing errors at specific stages.
Unlike most nodes that produce output data, the Throw node terminates execution by throwing an error that propagates up to the workflow runner, stopping all subsequent node execution.
Inputs
| Input | Type | Description | Default |
|---|---|---|---|
| Run | Event | Fires when the node starts running | - |
| Message | Text | The error message to throw. Can be a static string or dynamic data from another node. If left empty, defaults to "An error occurred." | - |
Outputs
This node produces no output data. When triggered, it throws an error and halts workflow execution.
Runtime Behavior and Defaults
When the Throw node receives a run event, it immediately throws a JavaScript Error object with the provided message. This error propagates to the workflow engine, which stops the entire workflow execution and reports the error.
- Default Message: If no message is provided (or if the message input is empty/undefined), the node throws with the message "An error occurred."
- Execution Flow: Because this node throws an error, any nodes connected to outputs of the Throw node will never execute.
- Error Handling: The error thrown will contain the message provided in the Message input, making it useful for debugging and logging purposes.
Example Usage
Basic Error Throwing
Connect a Start node to a Throw node to immediately fail a workflow with a custom message:
- Add a Start node
- Connect the Start node's
firedevent to the Throw node'sruninput - Set the Message input to "Workflow intentionally stopped"
When the workflow runs, it will immediately throw the error "Workflow intentionally stopped".
Conditional Error Handling
Use the Throw node with an If node to validate data and stop execution if conditions aren't met:
- Create an If node that checks if a required field exists
- Connect the If node's
falseoutput to the Throw node'sruninput - Set the Message input to "Required field is missing"
- Connect the If node's
trueoutput to your normal workflow logic
If the condition fails, the workflow will throw an error with your custom message. If the condition passes, the Throw node is never triggered and execution continues normally.
Dynamic Error Messages
Connect the Message input to a Text node or variable to create dynamic error messages:
Text Node: "Validation failed for user: {{userId}}"
↓
Throw Node (Message input)
↓
[Workflow stops with: "Validation failed for user: 12345"]