diff --git a/packages/nodes-base/nodes/Transform/Summarize/Summarize.node.ts b/packages/nodes-base/nodes/Transform/Summarize/Summarize.node.ts index 664bb7c5c4..9d8b7d5f06 100644 --- a/packages/nodes-base/nodes/Transform/Summarize/Summarize.node.ts +++ b/packages/nodes-base/nodes/Transform/Summarize/Summarize.node.ts @@ -7,8 +7,6 @@ import { type INodeTypeDescription, NodeExecutionOutput, type NodeExecutionHint, - NodeExecutionOutput, - type NodeExecutionHint, } from 'n8n-workflow'; import { @@ -245,7 +243,6 @@ export class Summarize implements INodeType { placeholder: 'Add option', default: {}, options: [ - // [ria] potentially delete this option?? { displayName: 'Continue if Field Not Found', name: 'continueIfFieldNotFound', @@ -323,18 +320,13 @@ export class Summarize implements INodeType { const nodeVersion = this.getNode().typeVersion; - if (nodeVersion < 2.1) { - const fieldNotFound: string | undefined = checkIfFieldExists.call( - this, - newItems, - fieldsToSummarize, - getValue, - ); - if (options.continueIfFieldNotFound || fieldNotFound) { - // const itemData: IPairedItemData[] = generatePairedItemData(items.length); // [ria] had to delete type because i was getting compilation errors + try { + checkIfFieldExists.call(this, newItems, fieldsToSummarize, getValue); + } catch (error) { + if (nodeVersion > 1 || options.continueIfFieldNotFound) { const itemData = generatePairedItemData(items.length); const fieldNotFoundHint: NodeExecutionHint = { - message: `The field '${fieldNotFound}' does not exist in any items.`, + message: error.message, location: 'outputPane', }; return new NodeExecutionOutput([[{ json: {}, pairedItem: itemData }]], [fieldNotFoundHint]);