Error Types
CrystalFlow includes several specialized error types:ExecutionError
Base class for all execution errors
NodeExecutionError
Errors during node execution
ValidationError
Workflow validation failures
TimeoutError
Execution timeout exceeded
CancellationError
Execution was cancelled
UserCancelledError
User-initiated cancellation
Basic Error Handling
Node Execution Errors
When a node fails, aNodeExecutionError is thrown with detailed context:
Error Properties
string
ID of the node that failed
string
Type of the node (e.g.,
'math.add')string
Unique execution identifier
string
Workflow identifier
Error
The original error that caused the failure
Validation Errors
Thrown when workflow validation fails:Timeout Errors
Thrown when execution exceeds the timeout limit:Cancellation Errors
Thrown when execution is cancelled:Error Events
Listen to error events during execution:Node-Level Error Handling
Handle errors within individual nodes:Validation in Nodes
Validate inputs before execution:Graceful Degradation
Continue execution with fallback values:Error Recovery
Implement retry logic with exponential backoff:Complete Error Handling Example
UI Error Display
Show errors to users in React:Best Practices
Always Catch Errors
Always Catch Errors
Wrap executor calls in try-catch blocks to handle failures gracefully.
Validate Early
Validate Early
Validate inputs at the beginning of execute() to fail fast.
Provide Context
Provide Context
Include helpful error messages with context about what failed and why.
Log Appropriately
Log Appropriately
Log errors with enough detail for debugging but not sensitive data.
Use Specific Error Types
Use Specific Error Types
Check for specific error types to handle different scenarios appropriately.
Clean Up Resources
Clean Up Resources
Always clean up resources (connections, timers) in finally blocks.
Next Steps
Execution & Events
Master the event system
Cancellation
Cancel long-running executions
Executor API
Complete Executor reference
Node API
Node class reference