n8n/packages/workflow/src/ExpressionError.ts
Jan Oberhauser bdb84130d6
feat(core): Add support for pairedItem (beta) (#3012)
*  Add pairedItem support

* 👕 Fix lint issue

* 🐛 Fix resolution in frontend

* 🐛 Fix resolution issue

* 🐛 Fix resolution in frontend

* 🐛 Fix another resolution issue in frontend

*  Try to automatically add pairedItem data if possible

*  Cleanup

*  Display expression errors in editor UI

* 🐛 Fix issue that it did not display errors in production

* 🐛 Fix auto-fix of missing pairedItem data

* 🐛 Fix frontend resolution for not executed nodes

*  Fail execution on pairedItem resolve issue and display information
about itemIndex and runIndex

*  Allow that pairedItem is only set to number if runIndex is 0

*  Improve Expression Errors

*  Remove no longer needed code

*  Make errors more helpful

*  Add additional errors

* 👕 Fix lint issue

*  Add pairedItem support to core nodes

*  Improve support in Merge-Node

*  Fix issue with not correctly converted incoming pairedItem data

* 🐛 Fix frontend resolve issue

* 🐛 Fix frontend parameter name display issue

*  Improve errors

* 👕 Fix lint issue

*  Improve errors

*  Make it possible to display parameter name in error messages

*  Improve error messages

*  Fix error message

*  Improve error messages

*  Add another error message

*  Simplify
2022-06-03 17:25:07 +02:00

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;
}
}