mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
returns warning instead of error when field not found
This commit is contained in:
parent
e13357ea86
commit
60edb9a41a
|
@ -7,6 +7,8 @@ import {
|
||||||
type INodeTypeDescription,
|
type INodeTypeDescription,
|
||||||
NodeExecutionOutput,
|
NodeExecutionOutput,
|
||||||
type NodeExecutionHint,
|
type NodeExecutionHint,
|
||||||
|
NodeExecutionOutput,
|
||||||
|
type NodeExecutionHint,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -243,6 +245,7 @@ export class Summarize implements INodeType {
|
||||||
placeholder: 'Add option',
|
placeholder: 'Add option',
|
||||||
default: {},
|
default: {},
|
||||||
options: [
|
options: [
|
||||||
|
// [ria] potentially delete this option??
|
||||||
{
|
{
|
||||||
displayName: 'Continue if Field Not Found',
|
displayName: 'Continue if Field Not Found',
|
||||||
name: 'continueIfFieldNotFound',
|
name: 'continueIfFieldNotFound',
|
||||||
|
@ -320,13 +323,18 @@ export class Summarize implements INodeType {
|
||||||
|
|
||||||
const nodeVersion = this.getNode().typeVersion;
|
const nodeVersion = this.getNode().typeVersion;
|
||||||
|
|
||||||
try {
|
if (nodeVersion < 2.1) {
|
||||||
checkIfFieldExists.call(this, newItems, fieldsToSummarize, getValue);
|
const fieldNotFound: string | undefined = checkIfFieldExists.call(
|
||||||
} catch (error) {
|
this,
|
||||||
if (nodeVersion > 1 || options.continueIfFieldNotFound) {
|
newItems,
|
||||||
|
fieldsToSummarize,
|
||||||
|
getValue,
|
||||||
|
);
|
||||||
|
if (options.continueIfFieldNotFound || fieldNotFound) {
|
||||||
|
// const itemData: IPairedItemData[] = generatePairedItemData(items.length); // [ria] had to delete type because i was getting compilation errors
|
||||||
const itemData = generatePairedItemData(items.length);
|
const itemData = generatePairedItemData(items.length);
|
||||||
const fieldNotFoundHint: NodeExecutionHint = {
|
const fieldNotFoundHint: NodeExecutionHint = {
|
||||||
message: error.message,
|
message: `The field '${fieldNotFound}' does not exist in any items.`,
|
||||||
location: 'outputPane',
|
location: 'outputPane',
|
||||||
};
|
};
|
||||||
return new NodeExecutionOutput([[{ json: {}, pairedItem: itemData }]], [fieldNotFoundHint]);
|
return new NodeExecutionOutput([[{ json: {}, pairedItem: itemData }]], [fieldNotFoundHint]);
|
||||||
|
|
Loading…
Reference in a new issue