@flowlab/all
Version:
A cool library focusing on handling various flows
41 lines (37 loc) • 1.26 kB
text/typescript
// Define custom error classes inheriting from Error
export class WorkflowError extends Error {
public readonly workflowId?: string;
constructor(message: string, workflowId?: string) {
super(message);
this.name = 'WorkflowError';
this.workflowId = workflowId;
}
}
export class NodeExecutionError extends WorkflowError {
public readonly nodeId?: string;
public readonly stepId?: string;
constructor(message: string, nodeId?: string, stepId?: string, workflowId?: string) {
super(message, workflowId);
this.name = 'NodeExecutionError';
this.nodeId = nodeId;
this.stepId = stepId;
}
}
export class TimeoutError extends NodeExecutionError {
constructor(message: string, nodeId?: string, stepId?: string, workflowId?: string) {
super(message, nodeId, stepId, workflowId);
this.name = 'TimeoutError';
}
}
export class AuthorizationError extends NodeExecutionError {
constructor(message: string, nodeId?: string, stepId?: string, workflowId?: string) {
super(message, nodeId, stepId, workflowId);
this.name = 'AuthorizationError';
}
}
export class ConfigurationError extends Error {
constructor(message: string) {
super(message);
this.name = 'ConfigurationError';
}
}