mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 11:01:15 +00:00
feat: use ES2022 native error chaining to improve error reporting (#4431)
feat: use ES2022 native error chaining
This commit is contained in:
committed by
GitHub
parent
3a9684df9f
commit
1f610b90f6
@@ -1,19 +1,27 @@
|
||||
import { INode } from './Interfaces';
|
||||
import { ExecutionBaseError } from './NodeErrors';
|
||||
|
||||
interface WorkflowActivationErrorOptions {
|
||||
cause?: Error;
|
||||
node?: INode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for instantiating an workflow activation error
|
||||
*/
|
||||
export class WorkflowActivationError extends ExecutionBaseError {
|
||||
node: INode | undefined;
|
||||
|
||||
constructor(message: string, error: Error, node?: INode) {
|
||||
super(error);
|
||||
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 });
|
||||
this.node = node;
|
||||
this.cause = {
|
||||
message: error.message,
|
||||
stack: error.stack as string,
|
||||
};
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user