2022-09-23 07:14:28 -07:00
|
|
|
import { INode } from './Interfaces';
|
|
|
|
import { ExecutionBaseError } from './NodeErrors';
|
2022-06-06 00:17:35 -07:00
|
|
|
|
2022-10-26 02:55:39 -07:00
|
|
|
interface WorkflowActivationErrorOptions {
|
|
|
|
cause?: Error;
|
|
|
|
node?: INode;
|
|
|
|
}
|
|
|
|
|
2022-06-06 00:17:35 -07:00
|
|
|
/**
|
|
|
|
* Class for instantiating an workflow activation error
|
|
|
|
*/
|
|
|
|
export class WorkflowActivationError extends ExecutionBaseError {
|
|
|
|
node: INode | undefined;
|
|
|
|
|
2022-10-26 02:55:39 -07:00
|
|
|
constructor(message: string, { cause, node }: WorkflowActivationErrorOptions) {
|
|
|
|
let error = cause as Error;
|
|
|
|
if (cause instanceof ExecutionBaseError) {
|
|
|
|
error = new Error(cause.message);
|
|
|
|
error.constructor = cause.constructor;
|
|
|
|
error.name = cause.name;
|
|
|
|
error.stack = cause.stack;
|
|
|
|
}
|
|
|
|
super(message, { cause: error });
|
2022-06-06 00:17:35 -07:00
|
|
|
this.node = node;
|
|
|
|
this.message = message;
|
|
|
|
}
|
|
|
|
}
|