Skip to main content
CrystalFlow provides a comprehensive error handling system with typed exceptions and detailed error context.

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, a NodeExecutionError 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

Wrap executor calls in try-catch blocks to handle failures gracefully.
Validate inputs at the beginning of execute() to fail fast.
Include helpful error messages with context about what failed and why.
Log errors with enough detail for debugging but not sensitive data.
Check for specific error types to handle different scenarios appropriately.
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