mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-28 12:50:50 -08:00
49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
|
// eslint-disable-next-line import/no-cycle
|
||
|
import { ExecutionBaseError } from './NodeErrors';
|
||
|
|
||
|
/**
|
||
|
* Class for instantiating an expression error
|
||
|
*/
|
||
|
export class ExpressionError extends ExecutionBaseError {
|
||
|
constructor(
|
||
|
message: string,
|
||
|
options?: {
|
||
|
causeDetailed?: string;
|
||
|
description?: string;
|
||
|
runIndex?: number;
|
||
|
itemIndex?: number;
|
||
|
messageTemplate?: string;
|
||
|
parameter?: string;
|
||
|
failExecution?: boolean;
|
||
|
},
|
||
|
) {
|
||
|
super(new Error(message));
|
||
|
|
||
|
if (options?.description !== undefined) {
|
||
|
this.description = options.description;
|
||
|
}
|
||
|
|
||
|
if (options?.causeDetailed !== undefined) {
|
||
|
this.context.causeDetailed = options.causeDetailed;
|
||
|
}
|
||
|
|
||
|
if (options?.runIndex !== undefined) {
|
||
|
this.context.runIndex = options.runIndex;
|
||
|
}
|
||
|
|
||
|
if (options?.itemIndex !== undefined) {
|
||
|
this.context.itemIndex = options.itemIndex;
|
||
|
}
|
||
|
|
||
|
if (options?.parameter !== undefined) {
|
||
|
this.context.parameter = options.parameter;
|
||
|
}
|
||
|
|
||
|
if (options?.messageTemplate !== undefined) {
|
||
|
this.context.messageTemplate = options.messageTemplate;
|
||
|
}
|
||
|
|
||
|
this.context.failExecution = !!options?.failExecution;
|
||
|
}
|
||
|
}
|