@flowlab/all
Version:
A cool library focusing on handling various flows
65 lines (58 loc) • 1.31 kB
text/typescript
// --- src/error/errors.ts ---
/**
* @fileoverview 自定义错误类
*/
/**
* MARK: 基础工作流错误
* 基础工作流错误
*/
export class WorkflowError extends Error {
constructor(message: string) {
super(message);
this.name = 'WorkflowError';
}
}
/**
* MARK: 节点执行错误
* 节点执行错误
*/
export class NodeExecutionError extends WorkflowError {
public readonly nodeId?: string;
public readonly stepId?: string;
constructor(message: string, nodeId?: string, stepId?: string) {
super(message);
this.name = 'NodeExecutionError';
this.nodeId = nodeId;
this.stepId = stepId;
}
}
/**
* MARK: 超时错误
* 超时错误
*/
export class TimeoutError extends NodeExecutionError {
constructor(message: string, nodeId?: string, stepId?: string) {
super(message, nodeId, stepId);
this.name = 'TimeoutError';
}
}
/**
* MARK: 权限错误
* 权限错误
*/
export class AuthorizationError extends WorkflowError {
constructor(message: string) {
super(message);
this.name = 'AuthorizationError';
}
}
/**
* MARK: 配置错误
* 配置错误
*/
export class ConfigurationError extends WorkflowError {
constructor(message: string) {
super(message);
this.name = 'ConfigurationError';
}
}