Files
Automata/packages/workflow/src/ExpressionError.ts
Jan Oberhauser 5526057efc feat(core): Improve paired item and add additional variables (#3765)
*  Remove duplicate and old string

*  Add telemetry

*  Futher improvements

*  Change error message and display only name of last parameter

* 👕 Fix lint issue

*  Remove not needed comments

*  Rename properties, add new ones and improve error messages

*  Add support for $execution, $prevNode and make it possible to use proxies as object

*  Some small improvements

* 🐛 Fix error message

*  Improve some error messages

*  Change resumeUrl variable and display in editor

*  Fix and extend tests

*  Multiple pairedItem improvements

*  Display "More Info" link with error messages if user can fix issue

*  Display different errors in Function Nodes
2022-09-29 23:02:25 +02:00

53 lines
1.1 KiB
TypeScript

/* eslint-disable import/no-cycle */
import { IDataObject } from './Interfaces';
import { ExecutionBaseError } from './NodeErrors';
/**
* Class for instantiating an expression error
*/
export class ExpressionError extends ExecutionBaseError {
constructor(
message: string,
options?: {
causeDetailed?: string;
description?: string;
descriptionTemplate?: string;
failExecution?: boolean;
functionality?: 'pairedItem';
itemIndex?: number;
messageTemplate?: string;
nodeCause?: string;
parameter?: string;
runIndex?: number;
type?: string;
},
) {
super(new Error(message));
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];
}
});
}
}
}