try node provides structured error handling, similar to try/catch/finally in programming languages. Use it to gracefully handle errors and ensure cleanup code runs.
Configuration
Config Fields
| Field | Type | Required | Description |
|---|---|---|---|
try | string[] | Yes | Node IDs to execute (at least one required) |
catch | string[] | No | Node IDs to execute if an error occurs |
finally | string[] | No | Node IDs that always execute |
Execution Flow
- Execute all nodes in
try - If error occurs, execute
catchnodes - Always execute
finallynodes - Continue with flow
Output
On Success
On Error
| Field | Type | Description |
|---|---|---|
success | boolean | Whether try block completed without error |
result | any | Output from last successful node |
error | string | Error message if failed |
failed_node | string | ID of node that failed |
Error Context
In thecatch block, error information is available:
| Expression | Description |
|---|---|
{{error.message}} | The error message |
{{error.node}} | ID of the node that failed |
{{error.type}} | Type of error |
Examples
Basic Error Handling
With Cleanup
Logging Errors
API Call with Fallback Response
Conditional Error Response
Nested Try Blocks
Try nodes can be nested for granular error handling:Use Cases
API Resilience
Wrap external API calls to handle failures gracefully:Transaction Safety
Ensure rollback happens if processing fails:Resource Cleanup
Always release resources regardless of success/failure:Error Propagation
- If
catchhandles the error, the flow continues normally - If
catchitself fails, the error propagates up finallyalways runs, even ifcatchfails
Related
- Abort Node - Explicitly fail the flow
- Condition Node - Check error status
- HTTP Node - Has built-in
on_erroroption