mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-02 07:01:30 -08:00
* refactor: use consistent folder structure across workflow, core, and cli * setup typescript project references across workflow, core, and cli
53 lines
1.1 KiB
TypeScript
53 lines
1.1 KiB
TypeScript
import { IDataObject } from './Interfaces';
|
|
import { ExecutionBaseError } from './NodeErrors';
|
|
|
|
/**
|
|
* Class for instantiating an expression error
|
|
*/
|
|
export class ExpressionError extends ExecutionBaseError {
|
|
constructor(
|
|
message: string,
|
|
options?: {
|
|
cause?: Error;
|
|
causeDetailed?: string;
|
|
description?: string;
|
|
descriptionTemplate?: string;
|
|
failExecution?: boolean;
|
|
functionality?: 'pairedItem';
|
|
itemIndex?: number;
|
|
messageTemplate?: string;
|
|
nodeCause?: string;
|
|
parameter?: string;
|
|
runIndex?: number;
|
|
type?: string;
|
|
},
|
|
) {
|
|
super(message, { cause: options?.cause });
|
|
|
|
if (options?.description !== undefined) {
|
|
this.description = options.description;
|
|
}
|
|
|
|
this.context.failExecution = !!options?.failExecution;
|
|
|
|
const allowedKeys = [
|
|
'causeDetailed',
|
|
'descriptionTemplate',
|
|
'functionality',
|
|
'itemIndex',
|
|
'messageTemplate',
|
|
'nodeCause',
|
|
'parameter',
|
|
'runIndex',
|
|
'type',
|
|
];
|
|
if (options !== undefined) {
|
|
Object.keys(options as IDataObject).forEach((key) => {
|
|
if (allowedKeys.includes(key)) {
|
|
this.context[key] = (options as IDataObject)[key];
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|