From 2a8043cd27968b92b1857135d130e3ee54aae779 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Tue, 12 Jul 2022 17:51:01 +0200 Subject: [PATCH] feat: Add item information to more node errors (#3681) * :zap: Add `itemIndex` to node-thrown errors * :zap: Add some missing item indexes --- .../nodes/ActionNetwork/ActionNetwork.node.ts | 3 ++ .../ActiveCampaign/ActiveCampaign.node.ts | 24 ++++++------- .../nodes/AgileCrm/AgileCrm.node.ts | 12 +++---- .../nodes/ApiTemplateIo/ApiTemplateIo.node.ts | 6 ++-- .../Aws/Rekognition/AwsRekognition.node.ts | 4 +-- .../nodes-base/nodes/Aws/S3/AwsS3.node.ts | 4 +-- .../nodes-base/nodes/Aws/SES/AwsSes.node.ts | 4 +-- .../nodes-base/nodes/Aws/SQS/AwsSqs.node.ts | 4 +-- .../nodes/Aws/Textract/AwsTextract.node.ts | 4 +-- .../employeeDocument/upload/execute.ts | 4 +-- .../v1/actions/file/upload/execute.ts | 6 ++-- .../nodes/Bitwarden/Bitwarden.node.ts | 6 ++-- packages/nodes-base/nodes/Box/Box.node.ts | 6 ++-- .../nodes-base/nodes/Bubble/Bubble.node.ts | 2 +- .../nodes/Chargebee/Chargebee.node.ts | 8 ++--- .../nodes/Cisco/Webex/CiscoWebex.node.ts | 2 +- .../nodes-base/nodes/ClickUp/ClickUp.node.ts | 12 +++---- .../nodes/Compression/Compression.node.ts | 8 ++--- .../nodes-base/nodes/Cortex/Cortex.node.ts | 12 +++---- .../nodes/CustomerIo/CustomerIo.node.ts | 8 ++--- .../nodes/DateTime/DateTime.node.ts | 2 +- .../nodes-base/nodes/Discord/Discord.node.ts | 8 ++--- .../nodes-base/nodes/Disqus/Disqus.node.ts | 4 +-- .../nodes-base/nodes/Dropbox/Dropbox.node.ts | 6 ++-- .../nodes-base/nodes/ERPNext/ERPNext.node.ts | 4 +-- .../nodes/EditImage/EditImage.node.ts | 6 ++-- .../ElasticSecurity/ElasticSecurity.node.ts | 4 ++- .../nodes/EmailReadImap/EmailReadImap.node.ts | 2 +- .../ExecuteCommand/ExecuteCommand.node.ts | 2 +- .../nodes/Facebook/FacebookGraphApi.node.ts | 6 ++-- .../nodes/FileMaker/FileMaker.node.ts | 4 +-- .../nodes/Freshdesk/Freshdesk.node.ts | 4 +-- packages/nodes-base/nodes/Ftp/Ftp.node.ts | 8 ++--- packages/nodes-base/nodes/Ghost/Ghost.node.ts | 8 ++--- .../nodes-base/nodes/Github/Github.node.ts | 7 ++-- .../nodes/GoToWebinar/GoToWebinar.node.ts | 2 +- .../Google/Calendar/GoogleCalendar.node.ts | 4 +-- .../nodes/Google/Chat/GoogleChat.node.ts | 10 +++--- .../nodes/Google/Drive/GoogleDrive.node.ts | 4 +-- .../Google/GSuiteAdmin/GSuiteAdmin.node.ts | 4 +-- .../Perspective/GooglePerspective.node.ts | 2 +- .../nodes/Google/YouTube/YouTube.node.ts | 10 +++--- .../nodes-base/nodes/GraphQL/GraphQL.node.ts | 4 +-- .../nodes/HackerNews/HackerNews.node.ts | 8 ++--- .../nodes-base/nodes/Harvest/Harvest.node.ts | 22 ++++++------ .../nodes/HelpScout/HelpScout.node.ts | 10 +++--- .../nodes/HtmlExtract/HtmlExtract.node.ts | 6 ++-- .../nodes/HttpRequest/HttpRequest.node.ts | 14 ++++---- .../nodes-base/nodes/Hubspot/Hubspot.node.ts | 2 +- .../nodes/HumanticAI/HumanticAi.node.ts | 8 ++--- .../nodes/Intercom/Intercom.node.ts | 10 +++--- .../nodes/ItemLists/ItemLists.node.ts | 4 +-- .../nodes/Iterable/Iterable.node.ts | 4 +-- packages/nodes-base/nodes/Jira/Jira.node.ts | 12 +++---- packages/nodes-base/nodes/Keap/Keap.node.ts | 8 ++--- .../nodes/Kitemaker/Kitemaker.node.ts | 4 +-- packages/nodes-base/nodes/Line/Line.node.ts | 4 +-- .../nodes/LinkedIn/LinkedIn.node.ts | 4 +-- .../nodes-base/nodes/Mailjet/Mailjet.node.ts | 4 +-- .../nodes/Marketstack/Marketstack.node.ts | 2 +- .../v1/actions/user/getAll/execute.ts | 12 +++---- .../nodes-base/nodes/Mautic/Mautic.node.ts | 4 +-- .../nodes-base/nodes/Medium/Medium.node.ts | 4 +-- .../nodes/MessageBird/MessageBird.node.ts | 4 +-- .../GraphSecurity/GenericFunctions.ts | 2 +- .../OneDrive/MicrosoftOneDrive.node.ts | 6 ++-- .../Outlook/MicrosoftOutlook.node.ts | 16 ++++----- .../Microsoft/ToDo/MicrosoftToDo.node.ts | 6 ++-- .../nodes-base/nodes/Mindee/Mindee.node.ts | 8 ++--- .../nodes-base/nodes/Mocean/Mocean.node.ts | 4 +-- .../nodes/MondayCom/MondayCom.node.ts | 8 ++--- .../MoveBinaryData/MoveBinaryData.node.ts | 2 +- packages/nodes-base/nodes/Msg91/Msg91.node.ts | 4 +-- packages/nodes-base/nodes/Nasa/Nasa.node.ts | 4 +-- .../nodes/NextCloud/NextCloud.node.ts | 6 ++-- .../nodes-base/nodes/NocoDB/NocoDB.node.ts | 8 ++--- .../OpenWeatherMap/OpenWeatherMap.node.ts | 4 +-- .../nodes-base/nodes/Paddle/Paddle.node.ts | 8 ++--- .../nodes-base/nodes/PayPal/PayPal.node.ts | 2 +- .../nodes/Pipedrive/Pipedrive.node.ts | 6 ++-- .../nodes/Pushbullet/Pushbullet.node.ts | 2 +- .../nodes/Pushover/Pushover.node.ts | 4 +-- .../nodes/QuickBase/QuickBase.node.ts | 4 +-- .../nodes/QuickBooks/QuickBooks.node.ts | 34 +++++++++---------- .../nodes/Raindrop/Raindrop.node.ts | 8 ++--- .../nodes-base/nodes/Rundeck/Rundeck.node.ts | 4 +-- packages/nodes-base/nodes/S3/S3.node.ts | 4 +-- .../nodes/Salesforce/Salesforce.node.ts | 10 +++--- .../nodes/Salesmate/Salesmate.node.ts | 6 ++-- .../nodes/SeaTable/SeaTable.node.ts | 4 +-- .../nodes/SendGrid/SendGrid.node.ts | 2 +- packages/nodes-base/nodes/Sendy/Sendy.node.ts | 10 +++--- .../nodes/ServiceNow/ServiceNow.node.ts | 14 ++++---- .../nodes-base/nodes/Shopify/Shopify.node.ts | 2 +- .../nodes-base/nodes/Signl4/Signl4.node.ts | 4 +-- packages/nodes-base/nodes/Slack/Slack.node.ts | 16 ++++----- .../SpreadsheetFile/SpreadsheetFile.node.ts | 4 +-- packages/nodes-base/nodes/Ssh/Ssh.node.ts | 4 +-- .../nodes-base/nodes/Stackby/Stackby.node.ts | 2 +- .../nodes-base/nodes/Strapi/Strapi.node.ts | 4 +-- .../nodes-base/nodes/Stripe/Stripe.node.ts | 6 ++-- .../nodes/Supabase/Supabase.node.ts | 6 ++-- .../v1/actions/ticket/update/execute.ts | 2 +- .../nodes/Tapfiliate/Tapfiliate.node.ts | 2 +- .../nodes/Telegram/Telegram.node.ts | 2 +- .../nodes-base/nodes/TheHive/TheHive.node.ts | 16 ++++----- .../nodes-base/nodes/Trello/Trello.node.ts | 18 +++++----- .../nodes-base/nodes/Twilio/Twilio.node.ts | 6 ++-- packages/nodes-base/nodes/Twist/Twist.node.ts | 12 +++---- .../nodes/Twitter/GenericFunctions.ts | 4 +-- .../nodes/UrlScanIo/UrlScanIo.node.ts | 2 +- packages/nodes-base/nodes/Wekan/Wekan.node.ts | 10 +++--- .../WriteBinaryFile/WriteBinaryFile.node.ts | 4 +-- packages/nodes-base/nodes/Xml/Xml.node.ts | 4 +-- .../nodes-base/nodes/Zammad/Zammad.node.ts | 2 +- .../nodes-base/nodes/Zendesk/Zendesk.node.ts | 4 +-- packages/nodes-base/nodes/Zulip/Zulip.node.ts | 6 ++-- 117 files changed, 376 insertions(+), 370 deletions(-) diff --git a/packages/nodes-base/nodes/ActionNetwork/ActionNetwork.node.ts b/packages/nodes-base/nodes/ActionNetwork/ActionNetwork.node.ts index 0d0dce6f41..259a4528e8 100644 --- a/packages/nodes-base/nodes/ActionNetwork/ActionNetwork.node.ts +++ b/packages/nodes-base/nodes/ActionNetwork/ActionNetwork.node.ts @@ -295,6 +295,7 @@ export class ActionNetwork implements INodeType { throw new NodeOperationError( this.getNode(), `Please enter at least one field to update for the ${resource}.`, + { itemIndex: i }, ); } @@ -364,6 +365,7 @@ export class ActionNetwork implements INodeType { throw new NodeOperationError( this.getNode(), `Please enter at least one field to update for the ${resource}.`, + { itemIndex: i }, ); } @@ -439,6 +441,7 @@ export class ActionNetwork implements INodeType { throw new NodeOperationError( this.getNode(), `Please enter at least one field to update for the ${resource}.`, + { itemIndex: i }, ); } diff --git a/packages/nodes-base/nodes/ActiveCampaign/ActiveCampaign.node.ts b/packages/nodes-base/nodes/ActiveCampaign/ActiveCampaign.node.ts index a9fad68670..d4d5957e7f 100644 --- a/packages/nodes-base/nodes/ActiveCampaign/ActiveCampaign.node.ts +++ b/packages/nodes-base/nodes/ActiveCampaign/ActiveCampaign.node.ts @@ -434,7 +434,7 @@ export class ActiveCampaign implements INodeType { addAdditionalFields(body.contact as IDataObject, updateFields); } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known`, { itemIndex: i }); } } else if (resource === 'account') { if (operation === 'create') { @@ -515,7 +515,7 @@ export class ActiveCampaign implements INodeType { addAdditionalFields(body.account as IDataObject, updateFields); } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known`, { itemIndex: i }); } } else if (resource === 'accountContact') { if (operation === 'create') { @@ -565,7 +565,7 @@ export class ActiveCampaign implements INodeType { endpoint = `/api/3/accountContacts/${accountContactId}`; } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known`, { itemIndex: i }); } } else if (resource === 'contactTag') { if (operation === 'add') { @@ -595,7 +595,7 @@ export class ActiveCampaign implements INodeType { endpoint = `/api/3/contactTags/${contactTagId}`; } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known`, { itemIndex: i }); } } else if (resource === 'contactList') { if (operation === 'add') { @@ -633,7 +633,7 @@ export class ActiveCampaign implements INodeType { dataKey = 'contacts'; } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known`, { itemIndex: i }); } } else if (resource === 'list') { if (operation === 'getAll') { @@ -735,7 +735,7 @@ export class ActiveCampaign implements INodeType { addAdditionalFields(body.tag as IDataObject, updateFields); } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known`, { itemIndex: i }); } } else if (resource === 'deal') { if (operation === 'create') { @@ -854,7 +854,7 @@ export class ActiveCampaign implements INodeType { endpoint = `/api/3/deals/${dealId}/notes/${dealNoteId}`; } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known`, { itemIndex: i }); } } else if (resource === 'connection') { if (operation === 'create') { @@ -929,7 +929,7 @@ export class ActiveCampaign implements INodeType { endpoint = `/api/3/connections`; } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known`, { itemIndex: i }); } } else if (resource === 'ecommerceOrder') { if (operation === 'create') { @@ -1027,7 +1027,7 @@ export class ActiveCampaign implements INodeType { endpoint = `/api/3/ecomOrders`; } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known`, { itemIndex: i }); } } else if (resource === 'ecommerceCustomer') { if (operation === 'create') { @@ -1117,7 +1117,7 @@ export class ActiveCampaign implements INodeType { endpoint = `/api/3/ecomCustomers`; } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known`, { itemIndex: i }); } } else if (resource === 'ecommerceOrderProducts') { if (operation === 'getByProductId') { @@ -1163,11 +1163,11 @@ export class ActiveCampaign implements INodeType { endpoint = `/api/3/ecomOrderProducts`; } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known`, { itemIndex: i }); } } else { - throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`); + throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i }); } let responseData; diff --git a/packages/nodes-base/nodes/AgileCrm/AgileCrm.node.ts b/packages/nodes-base/nodes/AgileCrm/AgileCrm.node.ts index 2b164e768b..6461e22fe1 100644 --- a/packages/nodes-base/nodes/AgileCrm/AgileCrm.node.ts +++ b/packages/nodes-base/nodes/AgileCrm/AgileCrm.node.ts @@ -156,14 +156,14 @@ export class AgileCrm implements INodeType { rules = getFilterRules(conditions, matchType); Object.assign(filterJson, rules); } else { - throw new NodeOperationError(this.getNode(), 'At least one condition must be added.'); + throw new NodeOperationError(this.getNode(), 'At least one condition must be added.', { itemIndex: i }); } } else if (filterType === 'json') { const filterJsonRules = this.getNodeParameter('filterJson', i) as string; if (validateJSON(filterJsonRules) !== undefined) { Object.assign(filterJson, JSON.parse(filterJsonRules) as IFilter); } else { - throw new NodeOperationError(this.getNode(), 'Filter (JSON) must be a valid json'); + throw new NodeOperationError(this.getNode(), 'Filter (JSON) must be a valid json', { itemIndex: i }); } } body.filterJson = JSON.stringify(filterJson); @@ -203,7 +203,7 @@ export class AgileCrm implements INodeType { Object.assign(body, JSON.parse(additionalFieldsJson)); } else { - throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON', { itemIndex: i }); } } @@ -359,7 +359,7 @@ export class AgileCrm implements INodeType { Object.assign(body, JSON.parse(additionalFieldsJson)); } else { - throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON', { itemIndex: i }); } } } else { @@ -537,7 +537,7 @@ export class AgileCrm implements INodeType { if (validateJSON(additionalFieldsJson) !== undefined) { Object.assign(body, JSON.parse(additionalFieldsJson)); } else { - throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON', { itemIndex: i }); } } @@ -579,7 +579,7 @@ export class AgileCrm implements INodeType { Object.assign(body, JSON.parse(additionalFieldsJson)); } else { - throw new NodeOperationError(this.getNode(), 'Additional fields must be valid JSON'); + throw new NodeOperationError(this.getNode(), 'Additional fields must be valid JSON', { itemIndex: i }); } } diff --git a/packages/nodes-base/nodes/ApiTemplateIo/ApiTemplateIo.node.ts b/packages/nodes-base/nodes/ApiTemplateIo/ApiTemplateIo.node.ts index 035503ccc9..c5a6ce9033 100644 --- a/packages/nodes-base/nodes/ApiTemplateIo/ApiTemplateIo.node.ts +++ b/packages/nodes-base/nodes/ApiTemplateIo/ApiTemplateIo.node.ts @@ -480,7 +480,7 @@ export class ApiTemplateIo implements INodeType { if (overrideJson !== '') { const data = validateJSON(overrideJson); if (data === undefined) { - throw new NodeOperationError(this.getNode(), 'A valid JSON must be provided.'); + throw new NodeOperationError(this.getNode(), 'A valid JSON must be provided.', { itemIndex: i }); } body.overrides = data; } @@ -548,14 +548,14 @@ export class ApiTemplateIo implements INodeType { if (jsonParameters === false) { const properties = (this.getNodeParameter('propertiesUi', i) as IDataObject || {}).propertyValues as IDataObject[] || []; if (properties.length === 0) { - throw new NodeOperationError(this.getNode(), 'The parameter properties cannot be empty'); + throw new NodeOperationError(this.getNode(), 'The parameter properties cannot be empty', { itemIndex: i }); } data = properties.reduce((obj, value) => Object.assign(obj, { [`${value.key}`]: value.value }), {}); } else { const propertiesJson = this.getNodeParameter('propertiesJson', i) as string; data = validateJSON(propertiesJson); if (data === undefined) { - throw new NodeOperationError(this.getNode(), 'A valid JSON must be provided.'); + throw new NodeOperationError(this.getNode(), 'A valid JSON must be provided.', { itemIndex: i }); } } diff --git a/packages/nodes-base/nodes/Aws/Rekognition/AwsRekognition.node.ts b/packages/nodes-base/nodes/Aws/Rekognition/AwsRekognition.node.ts index 4c7678dcdb..96f9b05e3e 100644 --- a/packages/nodes-base/nodes/Aws/Rekognition/AwsRekognition.node.ts +++ b/packages/nodes-base/nodes/Aws/Rekognition/AwsRekognition.node.ts @@ -460,11 +460,11 @@ export class AwsRekognition implements INodeType { const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0) as string; if (items[i].binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } if ((items[i].binary as IBinaryKeyData)[binaryPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex: i }); } const binaryPropertyData = (items[i].binary as IBinaryKeyData)[binaryPropertyName]; diff --git a/packages/nodes-base/nodes/Aws/S3/AwsS3.node.ts b/packages/nodes-base/nodes/Aws/S3/AwsS3.node.ts index db9c89bfcc..8a35569a01 100644 --- a/packages/nodes-base/nodes/Aws/S3/AwsS3.node.ts +++ b/packages/nodes-base/nodes/Aws/S3/AwsS3.node.ts @@ -598,11 +598,11 @@ export class AwsS3 implements INodeType { const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0) as string; if (items[i].binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } if ((items[i].binary as IBinaryKeyData)[binaryPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex: i }); } const binaryData = (items[i].binary as IBinaryKeyData)[binaryPropertyName]; diff --git a/packages/nodes-base/nodes/Aws/SES/AwsSes.node.ts b/packages/nodes-base/nodes/Aws/SES/AwsSes.node.ts index b98b49ba24..71ca162565 100644 --- a/packages/nodes-base/nodes/Aws/SES/AwsSes.node.ts +++ b/packages/nodes-base/nodes/Aws/SES/AwsSes.node.ts @@ -1121,7 +1121,7 @@ export class AwsSes implements INodeType { if (toAddresses.length) { setParameter(params, 'Destination.ToAddresses.member', toAddresses); } else { - throw new NodeOperationError(this.getNode(), 'At least one "To Address" has to be added!'); + throw new NodeOperationError(this.getNode(), 'At least one "To Address" has to be added!', { itemIndex: i }); } if (additionalFields.configurationSetName) { @@ -1174,7 +1174,7 @@ export class AwsSes implements INodeType { if (toAddresses.length) { setParameter(params, 'Destination.ToAddresses.member', toAddresses); } else { - throw new NodeOperationError(this.getNode(), 'At least one "To Address" has to be added!'); + throw new NodeOperationError(this.getNode(), 'At least one "To Address" has to be added!', { itemIndex: i }); } if (additionalFields.configurationSetName) { diff --git a/packages/nodes-base/nodes/Aws/SQS/AwsSqs.node.ts b/packages/nodes-base/nodes/Aws/SQS/AwsSqs.node.ts index 02f2383132..ba478456f0 100644 --- a/packages/nodes-base/nodes/Aws/SQS/AwsSqs.node.ts +++ b/packages/nodes-base/nodes/Aws/SQS/AwsSqs.node.ts @@ -363,11 +363,11 @@ export class AwsSqs implements INodeType { const item = items[i]; if (item.binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data set. So message attribute cannot be added!'); + throw new NodeOperationError(this.getNode(), 'No binary data set. So message attribute cannot be added!', { itemIndex: i }); } if (item.binary[dataPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `The binary property "${dataPropertyName}" does not exist. So message attribute cannot be added!`); + throw new NodeOperationError(this.getNode(), `The binary property "${dataPropertyName}" does not exist. So message attribute cannot be added!`, { itemIndex: i }); } const binaryData = item.binary[dataPropertyName].data; diff --git a/packages/nodes-base/nodes/Aws/Textract/AwsTextract.node.ts b/packages/nodes-base/nodes/Aws/Textract/AwsTextract.node.ts index 1cbdc05676..cd094e881d 100644 --- a/packages/nodes-base/nodes/Aws/Textract/AwsTextract.node.ts +++ b/packages/nodes-base/nodes/Aws/Textract/AwsTextract.node.ts @@ -122,11 +122,11 @@ export class AwsTextract implements INodeType { const simple = this.getNodeParameter('simple', i) as boolean; if (items[i].binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } if ((items[i].binary as IBinaryKeyData)[binaryProperty] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`, { itemIndex: i }); } const binaryPropertyData = (items[i].binary as IBinaryKeyData)[binaryProperty]; diff --git a/packages/nodes-base/nodes/BambooHr/v1/actions/employeeDocument/upload/execute.ts b/packages/nodes-base/nodes/BambooHr/v1/actions/employeeDocument/upload/execute.ts index cb17234cb8..90c260ff26 100644 --- a/packages/nodes-base/nodes/BambooHr/v1/actions/employeeDocument/upload/execute.ts +++ b/packages/nodes-base/nodes/BambooHr/v1/actions/employeeDocument/upload/execute.ts @@ -23,13 +23,13 @@ export async function upload(this: IExecuteFunctions, index: number) { const options = this.getNodeParameter('options', index) as IDataObject; if (items[index].binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: index }); } const propertyNameUpload = this.getNodeParameter('binaryPropertyName', index) as string; if (items[index]!.binary![propertyNameUpload] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${propertyNameUpload}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${propertyNameUpload}" does not exists on item!`, { itemIndex: index }); } const item = items[index].binary as IBinaryKeyData; diff --git a/packages/nodes-base/nodes/BambooHr/v1/actions/file/upload/execute.ts b/packages/nodes-base/nodes/BambooHr/v1/actions/file/upload/execute.ts index be6406848b..c9c711d671 100644 --- a/packages/nodes-base/nodes/BambooHr/v1/actions/file/upload/execute.ts +++ b/packages/nodes-base/nodes/BambooHr/v1/actions/file/upload/execute.ts @@ -23,13 +23,13 @@ export async function upload(this: IExecuteFunctions, index: number) { const share = this.getNodeParameter('options.share', index, true) as boolean; if (items[index].binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: index }); } const propertyNameUpload = this.getNodeParameter('binaryPropertyName', index) as string; if (items[index]!.binary![propertyNameUpload] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${propertyNameUpload}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${propertyNameUpload}" does not exists on item!`, { itemIndex: index }); } const item = items[index].binary as IBinaryKeyData; @@ -55,7 +55,7 @@ export async function upload(this: IExecuteFunctions, index: number) { }; Object.assign(body.formData, (share) ? { share: 'yes' } : { share: 'no' }); - + //endpoint const endpoint = `files`; const { headers } = await apiRequest.call(this, requestMethod, endpoint, {}, {}, body); diff --git a/packages/nodes-base/nodes/Bitwarden/Bitwarden.node.ts b/packages/nodes-base/nodes/Bitwarden/Bitwarden.node.ts index 311b9001d2..0ddec67dad 100644 --- a/packages/nodes-base/nodes/Bitwarden/Bitwarden.node.ts +++ b/packages/nodes-base/nodes/Bitwarden/Bitwarden.node.ts @@ -177,7 +177,7 @@ export class Bitwarden implements INodeType { const updateFields = this.getNodeParameter('updateFields', i) as CollectionUpdateFields; if (isEmpty(updateFields)) { - throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`); + throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i }); } const { groups, externalId } = updateFields; @@ -308,7 +308,7 @@ export class Bitwarden implements INodeType { const updateFields = this.getNodeParameter('updateFields', i) as GroupUpdateFields; if (isEmpty(updateFields)) { - throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`); + throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i }); } // set defaults for `name` and `accessAll`, required by Bitwarden but optional in n8n @@ -452,7 +452,7 @@ export class Bitwarden implements INodeType { const updateFields = this.getNodeParameter('updateFields', i) as MemberUpdateFields; if (isEmpty(updateFields)) { - throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`); + throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i }); } const { accessAll, collections, externalId, type } = updateFields; diff --git a/packages/nodes-base/nodes/Box/Box.node.ts b/packages/nodes-base/nodes/Box/Box.node.ts index 075a94ec37..abf9c91cab 100644 --- a/packages/nodes-base/nodes/Box/Box.node.ts +++ b/packages/nodes-base/nodes/Box/Box.node.ts @@ -268,11 +268,11 @@ export class Box implements INodeType { const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0) as string; if (items[i].binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } //@ts-ignore if (items[i].binary[binaryPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex: i }); } const binaryData = (items[i].binary as IBinaryKeyData)[binaryPropertyName]; @@ -300,7 +300,7 @@ export class Box implements INodeType { const content = this.getNodeParameter('fileContent', i) as string; if (fileName === '') { - throw new NodeOperationError(this.getNode(), 'File name must be set!'); + throw new NodeOperationError(this.getNode(), 'File name must be set!', { itemIndex: i }); } attributes['name'] = fileName; diff --git a/packages/nodes-base/nodes/Bubble/Bubble.node.ts b/packages/nodes-base/nodes/Bubble/Bubble.node.ts index 6d2427f2fe..2077e504aa 100644 --- a/packages/nodes-base/nodes/Bubble/Bubble.node.ts +++ b/packages/nodes-base/nodes/Bubble/Bubble.node.ts @@ -153,7 +153,7 @@ export class Bubble implements INodeType { const filter = options.filtersJson as string; const data = validateJSON(filter); if (data === undefined) { - throw new NodeOperationError(this.getNode(), 'Filters must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Filters must be a valid JSON', { itemIndex: i }); } qs.constraints = JSON.stringify(data); } diff --git a/packages/nodes-base/nodes/Chargebee/Chargebee.node.ts b/packages/nodes-base/nodes/Chargebee/Chargebee.node.ts index 74c08a4a44..5eaf3908cf 100644 --- a/packages/nodes-base/nodes/Chargebee/Chargebee.node.ts +++ b/packages/nodes-base/nodes/Chargebee/Chargebee.node.ts @@ -537,7 +537,7 @@ export class Chargebee implements INodeType { endpoint = `customers`; } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else if (resource === 'invoice') { @@ -575,7 +575,7 @@ export class Chargebee implements INodeType { const invoiceId = this.getNodeParameter('invoiceId', i) as string; endpoint = `invoices/${invoiceId.trim()}/pdf`; } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else if (resource === 'subscription') { @@ -601,10 +601,10 @@ export class Chargebee implements INodeType { endpoint = `subscriptions/${subscriptionId.trim()}/delete`; } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else { - throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`); + throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i }); } const options = { diff --git a/packages/nodes-base/nodes/Cisco/Webex/CiscoWebex.node.ts b/packages/nodes-base/nodes/Cisco/Webex/CiscoWebex.node.ts index 18ab4404de..13a68af67e 100644 --- a/packages/nodes-base/nodes/Cisco/Webex/CiscoWebex.node.ts +++ b/packages/nodes-base/nodes/Cisco/Webex/CiscoWebex.node.ts @@ -167,7 +167,7 @@ export class CiscoWebex implements INodeType { if (isBinaryData) { if (!items[i].binary) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const binaryPropertyName = file.binaryPropertyName as string; diff --git a/packages/nodes-base/nodes/ClickUp/ClickUp.node.ts b/packages/nodes-base/nodes/ClickUp/ClickUp.node.ts index 5aaec388ca..29cbbe84b4 100644 --- a/packages/nodes-base/nodes/ClickUp/ClickUp.node.ts +++ b/packages/nodes-base/nodes/ClickUp/ClickUp.node.ts @@ -720,14 +720,14 @@ export class ClickUp implements INodeType { }; if (type === 'number' || type === 'currency') { if (!additionalFields.unit) { - throw new NodeOperationError(this.getNode(), 'Unit field must be set'); + throw new NodeOperationError(this.getNode(), 'Unit field must be set', { itemIndex: i }); } } if (type === 'number' || type === 'percentaje' || type === 'automatic' || type === 'currency') { if (additionalFields.stepsStart === undefined || !additionalFields.stepsEnd === undefined) { - throw new NodeOperationError(this.getNode(), 'Steps start and steps end fields must be set'); + throw new NodeOperationError(this.getNode(), 'Steps start and steps end fields must be set', { itemIndex: i }); } } if (additionalFields.unit) { @@ -846,7 +846,7 @@ export class ClickUp implements INodeType { if (additionalFields.customFieldsJson) { const customFields = validateJSON(additionalFields.customFieldsJson as string); if (customFields === undefined) { - throw new NodeOperationError(this.getNode(), 'Custom Fields: Invalid JSON'); + throw new NodeOperationError(this.getNode(), 'Custom Fields: Invalid JSON', { itemIndex: i }); } body.custom_fields = customFields; } @@ -1043,7 +1043,7 @@ export class ClickUp implements INodeType { if (jsonParse === true) { body.value = validateJSON(body.value); if (body.value === undefined) { - throw new NodeOperationError(this.getNode(), 'Value is invalid JSON!'); + throw new NodeOperationError(this.getNode(), 'Value is invalid JSON!', { itemIndex: i }); } } else { //@ts-ignore @@ -1214,7 +1214,7 @@ export class ClickUp implements INodeType { if (responseData.data) { responseData = responseData.data; } else { - throw new NodeOperationError(this.getNode(), 'There seems to be nothing to stop.'); + throw new NodeOperationError(this.getNode(), 'There seems to be nothing to stop.', { itemIndex: i }); } } if (operation === 'delete') { @@ -1234,7 +1234,7 @@ export class ClickUp implements INodeType { if (tagsUi) { const tags = (tagsUi as IDataObject).tagsValues as IDataObject[]; if (tags === undefined) { - throw new NodeOperationError(this.getNode(), 'At least one tag must be set'); + throw new NodeOperationError(this.getNode(), 'At least one tag must be set', { itemIndex: i }); } body.tags = tags; } diff --git a/packages/nodes-base/nodes/Compression/Compression.node.ts b/packages/nodes-base/nodes/Compression/Compression.node.ts index 467974fb63..af14c7147a 100644 --- a/packages/nodes-base/nodes/Compression/Compression.node.ts +++ b/packages/nodes-base/nodes/Compression/Compression.node.ts @@ -217,11 +217,11 @@ export class Compression implements INodeType { for (const [index, binaryPropertyName] of binaryPropertyNames.entries()) { if (items[i].binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } //@ts-ignore if (items[i].binary[binaryPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex: i }); } const binaryData = (items[i].binary as IBinaryKeyData)[binaryPropertyName]; @@ -275,11 +275,11 @@ export class Compression implements INodeType { for (const [index, binaryPropertyName] of binaryPropertyNames.entries()) { if (items[i].binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } //@ts-ignore if (items[i].binary[binaryPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex: i }); } const binaryData = (items[i].binary as IBinaryKeyData)[binaryPropertyName]; diff --git a/packages/nodes-base/nodes/Cortex/Cortex.node.ts b/packages/nodes-base/nodes/Cortex/Cortex.node.ts index 6e516485f2..442b643cc8 100644 --- a/packages/nodes-base/nodes/Cortex/Cortex.node.ts +++ b/packages/nodes-base/nodes/Cortex/Cortex.node.ts @@ -233,13 +233,13 @@ export class Cortex implements INodeType { const item = items[i]; if (item.binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string; if (item.binary[binaryPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex: i }); } const fileBufferData = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName); @@ -388,13 +388,13 @@ export class Cortex implements INodeType { const item = items[i]; if (item.binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const binaryPropertyName = artifactvalue.binaryProperty as string; if (item.binary[binaryPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property '${binaryPropertyName}' does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property '${binaryPropertyName}' does not exists on item!`, { itemIndex: i }); } const binaryData = item.binary[binaryPropertyName] as IBinaryData; @@ -417,12 +417,12 @@ export class Cortex implements INodeType { const item = items[i]; if (item.binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const binaryPropertyName = (body.data as IDataObject).binaryPropertyName as string; if (item.binary[binaryPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex: i }); } const fileBufferData = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName); diff --git a/packages/nodes-base/nodes/CustomerIo/CustomerIo.node.ts b/packages/nodes-base/nodes/CustomerIo/CustomerIo.node.ts index 45cadd0da1..bcd1a43b78 100644 --- a/packages/nodes-base/nodes/CustomerIo/CustomerIo.node.ts +++ b/packages/nodes-base/nodes/CustomerIo/CustomerIo.node.ts @@ -133,7 +133,7 @@ export class CustomerIo implements INodeType { Object.assign(body, JSON.parse(additionalFieldsJson)); } else { - throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON', { itemIndex: i }); } } } else { @@ -177,7 +177,7 @@ export class CustomerIo implements INodeType { Object.assign(body, JSON.parse(additionalFieldsJson)); } else { - throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON', { itemIndex: i }); } } } else { @@ -240,7 +240,7 @@ export class CustomerIo implements INodeType { if (validateJSON(additionalFieldsJson) !== undefined) { Object.assign(body, JSON.parse(additionalFieldsJson)); } else { - throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON', { itemIndex: i }); } } } else { @@ -285,7 +285,7 @@ export class CustomerIo implements INodeType { Object.assign(body, JSON.parse(additionalFieldsJson)); } else { - throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON', { itemIndex: i }); } } } else { diff --git a/packages/nodes-base/nodes/DateTime/DateTime.node.ts b/packages/nodes-base/nodes/DateTime/DateTime.node.ts index 7df1c4e9b5..2806f38826 100644 --- a/packages/nodes-base/nodes/DateTime/DateTime.node.ts +++ b/packages/nodes-base/nodes/DateTime/DateTime.node.ts @@ -416,7 +416,7 @@ export class DateTime implements INodeType { continue; } if (options.fromFormat === undefined && !moment(currentDate as string | number).isValid()) { - throw new NodeOperationError(this.getNode(), 'The date input format could not be recognized. Please set the "From Format" field'); + throw new NodeOperationError(this.getNode(), 'The date input format could not be recognized. Please set the "From Format" field', { itemIndex: i }); } if (Number.isInteger(currentDate as unknown as number)) { diff --git a/packages/nodes-base/nodes/Discord/Discord.node.ts b/packages/nodes-base/nodes/Discord/Discord.node.ts index b18d24e30f..bfe65233cd 100644 --- a/packages/nodes-base/nodes/Discord/Discord.node.ts +++ b/packages/nodes-base/nodes/Discord/Discord.node.ts @@ -136,17 +136,17 @@ export class Discord implements INodeType { const options = this.getNodeParameter('options', i) as IDataObject; if (!body.content && !options.embeds) { - throw new NodeOperationError(this.getNode(), 'Either content or embeds must be set.'); + throw new NodeOperationError(this.getNode(), 'Either content or embeds must be set.', { itemIndex: i }); } if (options.embeds) { try { //@ts-expect-error body.embeds = JSON.parse(options.embeds); if (!Array.isArray(body.embeds)) { - throw new NodeOperationError(this.getNode(), 'Embeds must be an array of embeds.'); + throw new NodeOperationError(this.getNode(), 'Embeds must be an array of embeds.', { itemIndex: i }); } } catch (e) { - throw new NodeOperationError(this.getNode(), 'Embeds must be valid JSON.'); + throw new NodeOperationError(this.getNode(), 'Embeds must be valid JSON.', { itemIndex: i }); } } if (options.username) { @@ -158,7 +158,7 @@ export class Discord implements INodeType { //@ts-expect-error body.components = JSON.parse(options.components); } catch (e) { - throw new NodeOperationError(this.getNode(), 'Components must be valid JSON.'); + throw new NodeOperationError(this.getNode(), 'Components must be valid JSON.', { itemIndex: i }); } } diff --git a/packages/nodes-base/nodes/Disqus/Disqus.node.ts b/packages/nodes-base/nodes/Disqus/Disqus.node.ts index f47ac64c95..da9a3d87cd 100644 --- a/packages/nodes-base/nodes/Disqus/Disqus.node.ts +++ b/packages/nodes-base/nodes/Disqus/Disqus.node.ts @@ -776,11 +776,11 @@ export class Disqus implements INodeType { } } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else { - throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`); + throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i }); } } catch (error) { if (this.continueOnFail()) { diff --git a/packages/nodes-base/nodes/Dropbox/Dropbox.node.ts b/packages/nodes-base/nodes/Dropbox/Dropbox.node.ts index 1160c29c12..b75870a90d 100644 --- a/packages/nodes-base/nodes/Dropbox/Dropbox.node.ts +++ b/packages/nodes-base/nodes/Dropbox/Dropbox.node.ts @@ -870,13 +870,13 @@ export class Dropbox implements INodeType { const item = items[i]; if (item.binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const propertyNameUpload = this.getNodeParameter('binaryPropertyName', i) as string; if (item.binary[propertyNameUpload] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${propertyNameUpload}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${propertyNameUpload}" does not exists on item!`, { itemIndex: i }); } body = await this.helpers.getBinaryDataBuffer(i, propertyNameUpload); @@ -1001,7 +1001,7 @@ export class Dropbox implements INodeType { endpoint = 'https://api.dropboxapi.com/2/files/move_v2'; } } else { - throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`); + throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i }); } if (resource === 'file' && operation === 'download') { diff --git a/packages/nodes-base/nodes/ERPNext/ERPNext.node.ts b/packages/nodes-base/nodes/ERPNext/ERPNext.node.ts index 9272c69302..00cd20452d 100644 --- a/packages/nodes-base/nodes/ERPNext/ERPNext.node.ts +++ b/packages/nodes-base/nodes/ERPNext/ERPNext.node.ts @@ -207,7 +207,7 @@ export class ERPNext implements INodeType { const properties = this.getNodeParameter('properties', i) as DocumentProperties; if (!properties.customProperty.length) { - throw new NodeOperationError(this.getNode(), 'Please enter at least one property for the document to create.'); + throw new NodeOperationError(this.getNode(), 'Please enter at least one property for the document to create.', { itemIndex: i },); } properties.customProperty.forEach(property => { @@ -243,7 +243,7 @@ export class ERPNext implements INodeType { const properties = this.getNodeParameter('properties', i) as DocumentProperties; if (!properties.customProperty.length) { - throw new NodeOperationError(this.getNode(), 'Please enter at least one property for the document to update.'); + throw new NodeOperationError(this.getNode(), 'Please enter at least one property for the document to update.', { itemIndex: i }); } properties.customProperty.forEach(property => { diff --git a/packages/nodes-base/nodes/EditImage/EditImage.node.ts b/packages/nodes-base/nodes/EditImage/EditImage.node.ts index 8a9ad7e903..ae205afa6b 100644 --- a/packages/nodes-base/nodes/EditImage/EditImage.node.ts +++ b/packages/nodes-base/nodes/EditImage/EditImage.node.ts @@ -1196,11 +1196,11 @@ export class EditImage implements INodeType { if (operations[0].operation !== 'create') { // "create" generates a new image so does not require any incoming data. if (item.binary === undefined) { - throw new NodeOperationError(this.getNode(), 'Item does not contain any binary data.'); + throw new NodeOperationError(this.getNode(), 'Item does not contain any binary data.', { itemIndex }); } if (item.binary[dataPropertyName as string] === undefined) { - throw new NodeOperationError(this.getNode(), `Item does not contain any binary data with the name "${dataPropertyName}".`); + throw new NodeOperationError(this.getNode(), `Item does not contain any binary data with the name "${dataPropertyName}".`, { itemIndex }); } const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(itemIndex, dataPropertyName); @@ -1245,7 +1245,7 @@ export class EditImage implements INodeType { const geometryString = (positionX >= 0 ? '+' : '') + positionX + (positionY >= 0 ? '+' : '') + positionY; if (item.binary![operationData.dataPropertyNameComposite as string] === undefined) { - throw new NodeOperationError(this.getNode(), `Item does not contain any binary data with the name "${operationData.dataPropertyNameComposite}".`); + throw new NodeOperationError(this.getNode(), `Item does not contain any binary data with the name "${operationData.dataPropertyNameComposite}".`, { itemIndex }); } const { fd, path, cleanup } = await file(); diff --git a/packages/nodes-base/nodes/Elastic/ElasticSecurity/ElasticSecurity.node.ts b/packages/nodes-base/nodes/Elastic/ElasticSecurity/ElasticSecurity.node.ts index afa214fd81..a74c5e9507 100644 --- a/packages/nodes-base/nodes/Elastic/ElasticSecurity/ElasticSecurity.node.ts +++ b/packages/nodes-base/nodes/Elastic/ElasticSecurity/ElasticSecurity.node.ts @@ -214,6 +214,7 @@ export class ElasticSecurity implements INodeType { throw new NodeOperationError( this.getNode(), 'Connector Type does not match the type of the connector in Connector Name', + { itemIndex: i }, ); } @@ -386,6 +387,7 @@ export class ElasticSecurity implements INodeType { throw new NodeOperationError( this.getNode(), `Cannot add tag "${tagToAdd}" to case ID ${caseId} because this case already has this tag.`, + { itemIndex: i }, ); } @@ -425,7 +427,7 @@ export class ElasticSecurity implements INodeType { } = await elasticSecurityApiRequest.call(this, 'GET', `/cases/${caseId}`) as IDataObject & { tags: string[] }; if (!tags.includes(tagToRemove)) { - throw new NodeOperationError(this.getNode(), `Cannot remove tag "${tagToRemove}" from case ID ${caseId} because this case does not have this tag.`); + throw new NodeOperationError(this.getNode(), `Cannot remove tag "${tagToRemove}" from case ID ${caseId} because this case does not have this tag.`, { itemIndex: i }); } const body = {}; diff --git a/packages/nodes-base/nodes/EmailReadImap/EmailReadImap.node.ts b/packages/nodes-base/nodes/EmailReadImap/EmailReadImap.node.ts index 04561369cc..38488f2490 100644 --- a/packages/nodes-base/nodes/EmailReadImap/EmailReadImap.node.ts +++ b/packages/nodes-base/nodes/EmailReadImap/EmailReadImap.node.ts @@ -287,7 +287,7 @@ export class EmailReadImap implements INodeType { const part = _.find(message.parts, { which: '' }); if (part === undefined) { - throw new NodeOperationError(this.getNode(), 'Email part could not be parsed.'); + throw new NodeOperationError(this.getNode(), 'Email part could not be parsed.',); } const parsedEmail = await parseRawEmail.call(this, part.body, dataPropertyAttachmentsPrefixName); diff --git a/packages/nodes-base/nodes/ExecuteCommand/ExecuteCommand.node.ts b/packages/nodes-base/nodes/ExecuteCommand/ExecuteCommand.node.ts index b197cade2d..2a0a4512fa 100644 --- a/packages/nodes-base/nodes/ExecuteCommand/ExecuteCommand.node.ts +++ b/packages/nodes-base/nodes/ExecuteCommand/ExecuteCommand.node.ts @@ -109,7 +109,7 @@ export class ExecuteCommand implements INodeType { } = await execPromise(command); if (error !== undefined) { - throw new NodeOperationError(this.getNode(), error.message); + throw new NodeOperationError(this.getNode(), error.message, { itemIndex }); } returnItems.push( diff --git a/packages/nodes-base/nodes/Facebook/FacebookGraphApi.node.ts b/packages/nodes-base/nodes/Facebook/FacebookGraphApi.node.ts index d89057ba5a..6b6cf21a00 100644 --- a/packages/nodes-base/nodes/Facebook/FacebookGraphApi.node.ts +++ b/packages/nodes-base/nodes/Facebook/FacebookGraphApi.node.ts @@ -374,7 +374,7 @@ export class FacebookGraphApi implements INodeType { if (sendBinaryData) { const item = items[itemIndex]; if (item.binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex }); } const binaryPropertyNameFull = this.getNodeParameter('binaryPropertyName', itemIndex) as string; @@ -388,7 +388,7 @@ export class FacebookGraphApi implements INodeType { } if (item.binary[binaryPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex }); } const binaryProperty = item.binary[binaryPropertyName] as IBinaryData; @@ -435,7 +435,7 @@ export class FacebookGraphApi implements INodeType { if (typeof response === 'string') { if (this.continueOnFail() === false) { - throw new NodeOperationError(this.getNode(), 'Response body is not valid JSON.'); + throw new NodeOperationError(this.getNode(), 'Response body is not valid JSON.', { itemIndex }); } returnItems.push({ json: { message: response } }); diff --git a/packages/nodes-base/nodes/FileMaker/FileMaker.node.ts b/packages/nodes-base/nodes/FileMaker/FileMaker.node.ts index f115e1c010..25548422f3 100644 --- a/packages/nodes-base/nodes/FileMaker/FileMaker.node.ts +++ b/packages/nodes-base/nodes/FileMaker/FileMaker.node.ts @@ -881,7 +881,7 @@ export class FileMaker implements INodeType { ...parseScripts.call(this, i), }; } else { - throw new NodeOperationError(this.getNode(), `The action "${action}" is not implemented yet!`); + throw new NodeOperationError(this.getNode(), `The action "${action}" is not implemented yet!`, { itemIndex: i }); } // Now that the options are all set make the actual http request @@ -893,7 +893,7 @@ export class FileMaker implements INodeType { } if (typeof response === 'string') { - throw new NodeOperationError(this.getNode(), 'Response body is not valid JSON. Change "Response Format" to "String"'); + throw new NodeOperationError(this.getNode(), 'Response body is not valid JSON. Change "Response Format" to "String"', { itemIndex: i }); } returnData.push({json: response}); } diff --git a/packages/nodes-base/nodes/Freshdesk/Freshdesk.node.ts b/packages/nodes-base/nodes/Freshdesk/Freshdesk.node.ts index 7a6a00b1ee..62dca17344 100644 --- a/packages/nodes-base/nodes/Freshdesk/Freshdesk.node.ts +++ b/packages/nodes-base/nodes/Freshdesk/Freshdesk.node.ts @@ -1161,7 +1161,7 @@ export class Freshdesk implements INodeType { if (requester === 'requesterId') { // @ts-ignore if (isNaN(value)) { - throw new NodeOperationError(this.getNode(), 'Requester Id must be a number'); + throw new NodeOperationError(this.getNode(), 'Requester Id must be a number', { itemIndex: i }); } body.requester_id = parseInt(value, 10); } else if (requester === 'email') { @@ -1246,7 +1246,7 @@ export class Freshdesk implements INodeType { if (updateFields.requester === 'requesterId') { // @ts-ignore if (isNaN(parseInt(value, 10))) { - throw new NodeOperationError(this.getNode(), 'Requester Id must be a number'); + throw new NodeOperationError(this.getNode(), 'Requester Id must be a number', { itemIndex: i }); } body.requester_id = parseInt(value as string, 10); } else if (updateFields.requester === 'email') { diff --git a/packages/nodes-base/nodes/Ftp/Ftp.node.ts b/packages/nodes-base/nodes/Ftp/Ftp.node.ts index 52bf4426af..2a28687eea 100644 --- a/packages/nodes-base/nodes/Ftp/Ftp.node.ts +++ b/packages/nodes-base/nodes/Ftp/Ftp.node.ts @@ -509,13 +509,13 @@ export class Ftp implements INodeType { const item = items[i]; if (item.binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const propertyNameUpload = this.getNodeParameter('binaryPropertyName', i) as string; if (item.binary[propertyNameUpload] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${propertyNameUpload}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${propertyNameUpload}" does not exists on item!`, { itemIndex: i }); } const buffer = await this.helpers.getBinaryDataBuffer(i, propertyNameUpload); @@ -603,13 +603,13 @@ export class Ftp implements INodeType { const item = items[i]; if (item.binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const propertyNameUpload = this.getNodeParameter('binaryPropertyName', i) as string; if (item.binary[propertyNameUpload] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${propertyNameUpload}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${propertyNameUpload}" does not exists on item!`, { itemIndex: i }); } const buffer = await this.helpers.getBinaryDataBuffer(i, propertyNameUpload); diff --git a/packages/nodes-base/nodes/Ghost/Ghost.node.ts b/packages/nodes-base/nodes/Ghost/Ghost.node.ts index 209fa707b2..7a9222606b 100644 --- a/packages/nodes-base/nodes/Ghost/Ghost.node.ts +++ b/packages/nodes-base/nodes/Ghost/Ghost.node.ts @@ -226,7 +226,7 @@ export class Ghost implements INodeType { } else { const mobileDoc = validateJSON(content); if (mobileDoc === undefined) { - throw new NodeOperationError(this.getNode(), 'Content must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Content must be a valid JSON', { itemIndex: i }); } post.mobiledoc = content; } @@ -240,7 +240,7 @@ export class Ghost implements INodeType { } if (post.status === 'scheduled' && post.published_at === undefined) { - throw new NodeOperationError(this.getNode(), 'Published at must be define when status is scheduled'); + throw new NodeOperationError(this.getNode(), 'Published at must be define when status is scheduled', { itemIndex: i }); } responseData = await ghostApiRequest.call(this, 'POST', '/admin/posts', { posts: [post] }, qs); @@ -320,7 +320,7 @@ export class Ghost implements INodeType { } else { const mobileDoc = validateJSON(updateFields.contentJson as string || undefined); if (mobileDoc === undefined) { - throw new NodeOperationError(this.getNode(), 'Content must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Content must be a valid JSON', { itemIndex: i }); } post.mobiledoc = updateFields.contentJson; delete updateFields.contentJson; @@ -335,7 +335,7 @@ export class Ghost implements INodeType { } if (post.status === 'scheduled' && post.published_at === undefined) { - throw new NodeOperationError(this.getNode(), 'Published at must be define when status is scheduled'); + throw new NodeOperationError(this.getNode(), 'Published at must be define when status is scheduled', { itemIndex: i }); } post.updated_at = posts[0].updated_at; diff --git a/packages/nodes-base/nodes/Github/Github.node.ts b/packages/nodes-base/nodes/Github/Github.node.ts index 0d756ecf80..c7ee3002f4 100644 --- a/packages/nodes-base/nodes/Github/Github.node.ts +++ b/packages/nodes-base/nodes/Github/Github.node.ts @@ -1741,7 +1741,7 @@ export class Github implements INodeType { const item = items[i]; if (item.binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string; @@ -1750,6 +1750,7 @@ export class Github implements INodeType { throw new NodeOperationError( this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, + { itemIndex: i } ); } @@ -2103,7 +2104,7 @@ export class Github implements INodeType { } } } else { - throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`); + throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i }); } if (returnAll === true) { @@ -2123,7 +2124,7 @@ export class Github implements INodeType { if (asBinaryProperty === true) { if (Array.isArray(responseData)) { - throw new NodeOperationError(this.getNode(), 'File Path is a folder, not a file.'); + throw new NodeOperationError(this.getNode(), 'File Path is a folder, not a file.', { itemIndex: i }); } // Add the returned data to the item as binary property const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string; diff --git a/packages/nodes-base/nodes/GoToWebinar/GoToWebinar.node.ts b/packages/nodes-base/nodes/GoToWebinar/GoToWebinar.node.ts index 3c2f4afaf4..1194311264 100644 --- a/packages/nodes-base/nodes/GoToWebinar/GoToWebinar.node.ts +++ b/packages/nodes-base/nodes/GoToWebinar/GoToWebinar.node.ts @@ -662,7 +662,7 @@ export class GoToWebinar implements INodeType { Object.assign(body, updateFields); if (isEmpty(updateFields)) { - throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`); + throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i }); } const endpoint = `organizers/${organizerKey}/webinars/${webinarKey}`; diff --git a/packages/nodes-base/nodes/Google/Calendar/GoogleCalendar.node.ts b/packages/nodes-base/nodes/Google/Calendar/GoogleCalendar.node.ts index 537fe117bf..0fb308ba7d 100644 --- a/packages/nodes-base/nodes/Google/Calendar/GoogleCalendar.node.ts +++ b/packages/nodes-base/nodes/Google/Calendar/GoogleCalendar.node.ts @@ -330,7 +330,7 @@ export class GoogleCalendar implements INodeType { additionalFields.repeatUntil ) { throw new NodeOperationError(this.getNode(), - `You can set either 'Repeat How Many Times' or 'Repeat Until' but not both`, + `You can set either 'Repeat How Many Times' or 'Repeat Until' but not both`, { itemIndex: i } ); } if (additionalFields.repeatFrecuency) { @@ -577,7 +577,7 @@ export class GoogleCalendar implements INodeType { } else { if (updateFields.repeatHowManyTimes && updateFields.repeatUntil) { throw new NodeOperationError(this.getNode(), - `You can set either 'Repeat How Many Times' or 'Repeat Until' but not both`, + `You can set either 'Repeat How Many Times' or 'Repeat Until' but not both`, { itemIndex: i } ); } if (updateFields.repeatFrecuency) { diff --git a/packages/nodes-base/nodes/Google/Chat/GoogleChat.node.ts b/packages/nodes-base/nodes/Google/Chat/GoogleChat.node.ts index cfa0393532..d716835b0f 100644 --- a/packages/nodes-base/nodes/Google/Chat/GoogleChat.node.ts +++ b/packages/nodes-base/nodes/Google/Chat/GoogleChat.node.ts @@ -401,7 +401,7 @@ export class GoogleChat implements INodeType { if (validateJSON(messageJson as string) !== undefined) { message = JSON.parse(messageJson as string) as IMessage; } else { - throw new NodeOperationError(this.getNode(), 'Message (JSON) must be a valid json'); + throw new NodeOperationError(this.getNode(), 'Message (JSON) must be a valid json', { itemIndex: i }); } } @@ -410,7 +410,7 @@ export class GoogleChat implements INodeType { if (messageUi.text && messageUi.text !== '') { message.text = messageUi.text; } else { - throw new NodeOperationError(this.getNode(), 'Message Text must be provided.'); + throw new NodeOperationError(this.getNode(), 'Message Text must be provided.', { itemIndex: i }); } // // TODO: get cards from the UI // if (messageUi?.cards?.metadataValues && messageUi?.cards?.metadataValues.length !== 0) { @@ -485,7 +485,7 @@ export class GoogleChat implements INodeType { if (validateJSON(updateFieldsJson as string) !== undefined) { message = JSON.parse(updateFieldsJson as string) as IMessage; } else { - throw new NodeOperationError(this.getNode(), 'Update Fields (JSON) must be a valid json'); + throw new NodeOperationError(this.getNode(), 'Update Fields (JSON) must be a valid json', { itemIndex: i }); } } @@ -570,7 +570,7 @@ export class GoogleChat implements INodeType { if (validateJSON(messageJson as string) !== undefined) { message = JSON.parse(messageJson as string) as IMessage; } else { - throw new NodeOperationError(this.getNode(), 'Message (JSON) must be a valid json'); + throw new NodeOperationError(this.getNode(), 'Message (JSON) must be a valid json', { itemIndex: i }); } } @@ -579,7 +579,7 @@ export class GoogleChat implements INodeType { if (messageUi.text && messageUi.text !== '') { message.text = messageUi.text; } else { - throw new NodeOperationError(this.getNode(), 'Message Text must be provided.'); + throw new NodeOperationError(this.getNode(), 'Message Text must be provided.', { itemIndex: i }); } } diff --git a/packages/nodes-base/nodes/Google/Drive/GoogleDrive.node.ts b/packages/nodes-base/nodes/Google/Drive/GoogleDrive.node.ts index 80c850afb6..1bc6922517 100644 --- a/packages/nodes-base/nodes/Google/Drive/GoogleDrive.node.ts +++ b/packages/nodes-base/nodes/Google/Drive/GoogleDrive.node.ts @@ -2403,13 +2403,13 @@ export class GoogleDrive implements INodeType { const item = items[i]; if (item.binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const propertyNameUpload = this.getNodeParameter('binaryPropertyName', i) as string; if (item.binary[propertyNameUpload] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${propertyNameUpload}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${propertyNameUpload}" does not exists on item!`, { itemIndex: i }); } if (item.binary[propertyNameUpload].mimeType) { diff --git a/packages/nodes-base/nodes/Google/GSuiteAdmin/GSuiteAdmin.node.ts b/packages/nodes-base/nodes/Google/GSuiteAdmin/GSuiteAdmin.node.ts index 31f40e7b86..e33eedaee3 100644 --- a/packages/nodes-base/nodes/Google/GSuiteAdmin/GSuiteAdmin.node.ts +++ b/packages/nodes-base/nodes/Google/GSuiteAdmin/GSuiteAdmin.node.ts @@ -329,7 +329,7 @@ export class GSuiteAdmin implements INodeType { } if (qs.projection === 'custom' && qs.customFieldMask === undefined) { - throw new NodeOperationError(this.getNode(), 'When projection is set to custom, the custom schemas field must be defined'); + throw new NodeOperationError(this.getNode(), 'When projection is set to custom, the custom schemas field must be defined', { itemIndex: i }); } responseData = await googleApiRequest.call( @@ -362,7 +362,7 @@ export class GSuiteAdmin implements INodeType { } if (qs.projection === 'custom' && qs.customFieldMask === undefined) { - throw new NodeOperationError(this.getNode(), 'When projection is set to custom, the custom schemas field must be defined'); + throw new NodeOperationError(this.getNode(), 'When projection is set to custom, the custom schemas field must be defined', { itemIndex: i }); } if (returnAll) { diff --git a/packages/nodes-base/nodes/Google/Perspective/GooglePerspective.node.ts b/packages/nodes-base/nodes/Google/Perspective/GooglePerspective.node.ts index a7e0d34b12..47bfe136d9 100644 --- a/packages/nodes-base/nodes/Google/Perspective/GooglePerspective.node.ts +++ b/packages/nodes-base/nodes/Google/Perspective/GooglePerspective.node.ts @@ -241,7 +241,7 @@ export class GooglePerspective implements INodeType { if (!attributes.length) { throw new NodeOperationError( this.getNode(), - 'Please enter at least one attribute to analyze.', + 'Please enter at least one attribute to analyze.', { itemIndex: i } ); } diff --git a/packages/nodes-base/nodes/Google/YouTube/YouTube.node.ts b/packages/nodes-base/nodes/Google/YouTube/YouTube.node.ts index d8b43ca0dc..47a549814e 100644 --- a/packages/nodes-base/nodes/Google/YouTube/YouTube.node.ts +++ b/packages/nodes-base/nodes/Google/YouTube/YouTube.node.ts @@ -413,11 +413,11 @@ export class YouTube implements INodeType { const item = items[i]; if (item.binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } if (item.binary[binaryProperty] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`, { itemIndex: i }); } if (item.binary[binaryProperty].mimeType) { @@ -826,7 +826,7 @@ export class YouTube implements INodeType { } if (qs.relatedToVideoId && qs.forDeveloper !== undefined) { - throw new NodeOperationError(this.getNode(), `When using the parameter 'related to video' the parameter 'for developer' cannot be set`); + throw new NodeOperationError(this.getNode(), `When using the parameter 'related to video' the parameter 'for developer' cannot be set`, { itemIndex: i }); } if (returnAll) { @@ -900,11 +900,11 @@ export class YouTube implements INodeType { const item = items[i]; if (item.binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } if (item.binary[binaryProperty] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`, { itemIndex: i }); } if (item.binary[binaryProperty].mimeType) { diff --git a/packages/nodes-base/nodes/GraphQL/GraphQL.node.ts b/packages/nodes-base/nodes/GraphQL/GraphQL.node.ts index 64cbd140fb..4b3fcd98ed 100644 --- a/packages/nodes-base/nodes/GraphQL/GraphQL.node.ts +++ b/packages/nodes-base/nodes/GraphQL/GraphQL.node.ts @@ -416,7 +416,7 @@ export class GraphQL implements INodeType { try { requestOptions.body.variables = JSON.parse(requestOptions.body.variables || '{}'); } catch (error) { - throw new NodeOperationError(this.getNode(), 'Using variables failed:\n' + requestOptions.body.variables + '\n\nWith error message:\n' + error); + throw new NodeOperationError(this.getNode(), 'Using variables failed:\n' + requestOptions.body.variables + '\n\nWith error message:\n' + error, { itemIndex }); } } if (requestOptions.body.operationName === '') { @@ -450,7 +450,7 @@ export class GraphQL implements INodeType { try { response = JSON.parse(response); } catch (error) { - throw new NodeOperationError(this.getNode(), 'Response body is not valid JSON. Change "Response Format" to "String"'); + throw new NodeOperationError(this.getNode(), 'Response body is not valid JSON. Change "Response Format" to "String"', { itemIndex }); } } diff --git a/packages/nodes-base/nodes/HackerNews/HackerNews.node.ts b/packages/nodes-base/nodes/HackerNews/HackerNews.node.ts index c32b9a49db..f9b4b96ec1 100644 --- a/packages/nodes-base/nodes/HackerNews/HackerNews.node.ts +++ b/packages/nodes-base/nodes/HackerNews/HackerNews.node.ts @@ -335,7 +335,7 @@ export class HackerNews implements INodeType { endpoint = 'search?'; } else { - throw new NodeOperationError(this.getNode(), `The operation '${operation}' is unknown!`); + throw new NodeOperationError(this.getNode(), `The operation '${operation}' is unknown!`, { itemIndex: i }); } } else if (resource === 'article') { @@ -346,7 +346,7 @@ export class HackerNews implements INodeType { includeComments = additionalFields.includeComments as boolean; } else { - throw new NodeOperationError(this.getNode(), `The operation '${operation}' is unknown!`); + throw new NodeOperationError(this.getNode(), `The operation '${operation}' is unknown!`, { itemIndex: i }); } } else if (resource === 'user') { @@ -355,11 +355,11 @@ export class HackerNews implements INodeType { endpoint = `users/${this.getNodeParameter('username', i)}`; } else { - throw new NodeOperationError(this.getNode(), `The operation '${operation}' is unknown!`); + throw new NodeOperationError(this.getNode(), `The operation '${operation}' is unknown!`, { itemIndex: i }); } } else { - throw new NodeOperationError(this.getNode(), `The resource '${resource}' is unknown!`); + throw new NodeOperationError(this.getNode(), `The resource '${resource}' is unknown!`, { itemIndex: i }); } diff --git a/packages/nodes-base/nodes/Harvest/Harvest.node.ts b/packages/nodes-base/nodes/Harvest/Harvest.node.ts index 8b00c92d6b..bb036edbd4 100644 --- a/packages/nodes-base/nodes/Harvest/Harvest.node.ts +++ b/packages/nodes-base/nodes/Harvest/Harvest.node.ts @@ -369,7 +369,7 @@ export class Harvest implements INodeType { returnData.push(responseData); } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else if (resource === 'client') { @@ -437,7 +437,7 @@ export class Harvest implements INodeType { const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint); returnData.push(responseData); } else { - throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`); + throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i }); } } else if (resource === 'project') { if (operation === 'get') { @@ -508,7 +508,7 @@ export class Harvest implements INodeType { const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint); returnData.push(responseData); } else { - throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`); + throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i }); } } else if (resource === 'user') { if (operation === 'get') { @@ -589,7 +589,7 @@ export class Harvest implements INodeType { const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint); returnData.push(responseData); } else { - throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`); + throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i }); } } else if (resource === 'contact') { if (operation === 'get') { @@ -657,7 +657,7 @@ export class Harvest implements INodeType { const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint); returnData.push(responseData); } else { - throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`); + throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i }); } } else if (resource === 'company') { if (operation === 'get') { @@ -672,7 +672,7 @@ export class Harvest implements INodeType { returnData.push(responseData); } else { - throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`); + throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i }); } } else if (resource === 'task') { if (operation === 'get') { @@ -739,7 +739,7 @@ export class Harvest implements INodeType { const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint); returnData.push(responseData); } else { - throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`); + throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i }); } } else if (resource === 'invoice') { if (operation === 'get') { @@ -806,7 +806,7 @@ export class Harvest implements INodeType { const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint); returnData.push(responseData); } else { - throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`); + throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i }); } } else if (resource === 'expense') { if (operation === 'get') { @@ -875,7 +875,7 @@ export class Harvest implements INodeType { const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint); returnData.push(responseData); } else { - throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`); + throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i }); } } else if (resource === 'estimate') { if (operation === 'get') { @@ -942,10 +942,10 @@ export class Harvest implements INodeType { const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint); returnData.push(responseData); } else { - throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`); + throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i }); } } else { - throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`); + throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i }); } } catch (error) { if (this.continueOnFail()) { diff --git a/packages/nodes-base/nodes/HelpScout/HelpScout.node.ts b/packages/nodes-base/nodes/HelpScout/HelpScout.node.ts index 8d0447ca90..a7f04b2359 100644 --- a/packages/nodes-base/nodes/HelpScout/HelpScout.node.ts +++ b/packages/nodes-base/nodes/HelpScout/HelpScout.node.ts @@ -204,7 +204,7 @@ export class HelpScout implements INodeType { delete body.customerEmail; } if (body.customer === undefined) { - throw new NodeOperationError(this.getNode(), 'Either customer email or customer ID must be set'); + throw new NodeOperationError(this.getNode(), 'Either customer email or customer ID must be set', { itemIndex: i }); } if (threads) { for (let i = 0; i < threads.length; i++) { @@ -290,7 +290,7 @@ export class HelpScout implements INodeType { body.websites = websites; } if (Object.keys(body).length === 0) { - throw new NodeOperationError(this.getNode(), 'You have to set at least one field'); + throw new NodeOperationError(this.getNode(), 'You have to set at least one field', { itemIndex: i }); } responseData = await helpscoutApiRequest.call(this, 'POST', '/v2/customers', body, qs, undefined, { resolveWithFullResponse: true }); const id = responseData.headers['resource-id']; @@ -336,7 +336,7 @@ export class HelpScout implements INodeType { body.age = body.age.toString(); } if (Object.keys(body).length === 0) { - throw new NodeOperationError(this.getNode(), 'You have to set at least one field'); + throw new NodeOperationError(this.getNode(), 'You have to set at least one field', { itemIndex: i }); } responseData = await helpscoutApiRequest.call(this, 'PUT', `/v2/customers/${customerId}`, body, qs, undefined, { resolveWithFullResponse: true }); responseData = { success: true }; @@ -388,7 +388,7 @@ export class HelpScout implements INodeType { delete body.customerEmail; } if (body.customer === undefined) { - throw new NodeOperationError(this.getNode(), 'Either customer email or customer ID must be set'); + throw new NodeOperationError(this.getNode(), 'Either customer email or customer ID must be set', { itemIndex: i }); } if (attachments) { if (attachments.attachmentsValues @@ -407,7 +407,7 @@ export class HelpScout implements INodeType { mimeType: binaryProperty.mimeType, }; } else { - throw new NodeOperationError(this.getNode(), `Binary property ${value.property} does not exist on input`); + throw new NodeOperationError(this.getNode(), `Binary property ${value.property} does not exist on input`, { itemIndex: i }); } }; body.attachments?.push.apply(body.attachments, (attachments.attachmentsBinary as IDataObject[]).map(mapFunction) as IAttachment[]); diff --git a/packages/nodes-base/nodes/HtmlExtract/HtmlExtract.node.ts b/packages/nodes-base/nodes/HtmlExtract/HtmlExtract.node.ts index 9d9daed545..b6c1d1e601 100644 --- a/packages/nodes-base/nodes/HtmlExtract/HtmlExtract.node.ts +++ b/packages/nodes-base/nodes/HtmlExtract/HtmlExtract.node.ts @@ -229,15 +229,15 @@ export class HtmlExtract implements INodeType { let htmlArray: string[] | string = []; if (sourceData === 'json') { if (item.json[dataPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No property named "${dataPropertyName}" exists!`); + throw new NodeOperationError(this.getNode(), `No property named "${dataPropertyName}" exists!`, { itemIndex }); } htmlArray = item.json[dataPropertyName] as string; } else { if (item.binary === undefined) { - throw new NodeOperationError(this.getNode(), `No item does not contain binary data!`); + throw new NodeOperationError(this.getNode(), `No item does not contain binary data!`, { itemIndex }); } if (item.binary[dataPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No property named "${dataPropertyName}" exists!`); + throw new NodeOperationError(this.getNode(), `No property named "${dataPropertyName}" exists!`, { itemIndex }); } const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(itemIndex, dataPropertyName); diff --git a/packages/nodes-base/nodes/HttpRequest/HttpRequest.node.ts b/packages/nodes-base/nodes/HttpRequest/HttpRequest.node.ts index b19453870c..f1be7f1d6d 100644 --- a/packages/nodes-base/nodes/HttpRequest/HttpRequest.node.ts +++ b/packages/nodes-base/nodes/HttpRequest/HttpRequest.node.ts @@ -993,19 +993,19 @@ export class HttpRequest implements INodeType { if (!contentTypesAllowed.includes(options.bodyContentType as string)) { // As n8n-workflow.NodeHelpers.getParamterResolveOrder can not be changed // easily to handle parameters in dot.notation simply error for now. - throw new NodeOperationError(this.getNode(), 'Sending binary data is only supported when option "Body Content Type" is set to "RAW/CUSTOM" or "FORM-DATA/MULTIPART"!'); + throw new NodeOperationError(this.getNode(), 'Sending binary data is only supported when option "Body Content Type" is set to "RAW/CUSTOM" or "FORM-DATA/MULTIPART"!', { itemIndex }); } const item = items[itemIndex]; if (item.binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex }); } if (options.bodyContentType === 'raw') { const binaryPropertyName = this.getNodeParameter('binaryPropertyName', itemIndex) as string; if (item.binary[binaryPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex }); } const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(itemIndex, binaryPropertyName); @@ -1023,7 +1023,7 @@ export class HttpRequest implements INodeType { propertyName = propertyDataParts[0]; binaryPropertyName = propertyDataParts[1]; } else if (binaryPropertyNames.length > 1) { - throw new NodeOperationError(this.getNode(), 'If more than one property should be send it is needed to define the in the format:"sendKey1:binaryProperty1,sendKey2:binaryProperty2"'); + throw new NodeOperationError(this.getNode(), 'If more than one property should be send it is needed to define the in the format:"sendKey1:binaryProperty1,sendKey2:binaryProperty2"', { itemIndex }); } if (item.binary[binaryPropertyName] === undefined) { @@ -1061,7 +1061,7 @@ export class HttpRequest implements INodeType { // @ts-ignore requestOptions[optionData.name] = JSON.parse(requestOptions[optionData.name]); } catch (error) { - throw new NodeOperationError(this.getNode(), `The data in "${optionData.displayName}" is no valid JSON. Set Body Content Type to "RAW/Custom" for XML or other types of payloads`); + throw new NodeOperationError(this.getNode(), `The data in "${optionData.displayName}" is no valid JSON. Set Body Content Type to "RAW/Custom" for XML or other types of payloads`, { itemIndex }); } } } @@ -1349,7 +1349,7 @@ export class HttpRequest implements INodeType { try { returnItem.body = JSON.parse(returnItem.body); } catch (error) { - throw new NodeOperationError(this.getNode(), 'Response body is not valid JSON. Change "Response Format" to "String"'); + throw new NodeOperationError(this.getNode(), 'Response body is not valid JSON. Change "Response Format" to "String"', { itemIndex }); } } @@ -1364,7 +1364,7 @@ export class HttpRequest implements INodeType { try { response = JSON.parse(response); } catch (error) { - throw new NodeOperationError(this.getNode(), 'Response body is not valid JSON. Change "Response Format" to "String"'); + throw new NodeOperationError(this.getNode(), 'Response body is not valid JSON. Change "Response Format" to "String"', { itemIndex }); } } diff --git a/packages/nodes-base/nodes/Hubspot/Hubspot.node.ts b/packages/nodes-base/nodes/Hubspot/Hubspot.node.ts index 7d61824dab..c3a6576c75 100644 --- a/packages/nodes-base/nodes/Hubspot/Hubspot.node.ts +++ b/packages/nodes-base/nodes/Hubspot/Hubspot.node.ts @@ -2200,7 +2200,7 @@ export class Hubspot implements INodeType { if (!Object.keys(metadata).length) { throw new NodeOperationError( this.getNode(), - `At least one metadata field needs to set`, + `At least one metadata field needs to set`, { itemIndex: i } ); } diff --git a/packages/nodes-base/nodes/HumanticAI/HumanticAi.node.ts b/packages/nodes-base/nodes/HumanticAI/HumanticAi.node.ts index 501f179f0a..93cffa1ef7 100644 --- a/packages/nodes-base/nodes/HumanticAI/HumanticAi.node.ts +++ b/packages/nodes-base/nodes/HumanticAI/HumanticAi.node.ts @@ -81,7 +81,7 @@ export class HumanticAi implements INodeType { const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string; if (items[i].binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const item = items[i].binary as IBinaryKeyData; @@ -90,7 +90,7 @@ export class HumanticAi implements INodeType { const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName); if (binaryData === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex: i }); } responseData = await humanticAiApiRequest.call( @@ -142,7 +142,7 @@ export class HumanticAi implements INodeType { const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string; if (items[i].binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const item = items[i].binary as IBinaryKeyData; @@ -151,7 +151,7 @@ export class HumanticAi implements INodeType { const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName); if (binaryData === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex: i }); } responseData = await humanticAiApiRequest.call( diff --git a/packages/nodes-base/nodes/Intercom/Intercom.node.ts b/packages/nodes-base/nodes/Intercom/Intercom.node.ts index 89da4cfe70..56c1baec03 100644 --- a/packages/nodes-base/nodes/Intercom/Intercom.node.ts +++ b/packages/nodes-base/nodes/Intercom/Intercom.node.ts @@ -423,7 +423,7 @@ export class Intercom implements INodeType { try { responseData = await intercomApiRequest.call(this, `/users/${id}`, 'DELETE'); } catch (error) { - throw new NodeOperationError(this.getNode(), `Intercom Error: ${JSON.stringify(error)}`); + throw new NodeOperationError(this.getNode(), `Intercom Error: ${JSON.stringify(error)}`, { itemIndex: i }); } } } @@ -473,7 +473,7 @@ export class Intercom implements INodeType { try { responseData = await intercomApiRequest.call(this, '/companies', 'POST', body, qs); } catch (error) { - throw new NodeOperationError(this.getNode(), `Intercom Error: ${JSON.stringify(error)}`); + throw new NodeOperationError(this.getNode(), `Intercom Error: ${JSON.stringify(error)}`, { itemIndex: i }); } } if (operation === 'get') { @@ -492,7 +492,7 @@ export class Intercom implements INodeType { responseData = await intercomApiRequest.call(this, '/companies', 'GET', {}, qs); } } catch (error) { - throw new NodeOperationError(this.getNode(), `Intercom Error: ${JSON.stringify(error)}`); + throw new NodeOperationError(this.getNode(), `Intercom Error: ${JSON.stringify(error)}`, { itemIndex: i }); } } if (operation === 'getAll') { @@ -509,7 +509,7 @@ export class Intercom implements INodeType { responseData = responseData.companies; } } catch (error) { - throw new NodeOperationError(this.getNode(), `Intercom Error: ${JSON.stringify(error)}`); + throw new NodeOperationError(this.getNode(), `Intercom Error: ${JSON.stringify(error)}`, { itemIndex: i }); } } if (operation === 'users') { @@ -543,7 +543,7 @@ export class Intercom implements INodeType { } } } catch (error) { - throw new NodeOperationError(this.getNode(), `Intercom Error: ${JSON.stringify(error)}`); + throw new NodeOperationError(this.getNode(), `Intercom Error: ${JSON.stringify(error)}`, { itemIndex: i }); } } } diff --git a/packages/nodes-base/nodes/ItemLists/ItemLists.node.ts b/packages/nodes-base/nodes/ItemLists/ItemLists.node.ts index cef600fae0..f73e38f128 100644 --- a/packages/nodes-base/nodes/ItemLists/ItemLists.node.ts +++ b/packages/nodes-base/nodes/ItemLists/ItemLists.node.ts @@ -696,12 +696,12 @@ return 0;`, if (fieldToSplitOut.includes('.') && disableDotNotation === true) { throw new NodeOperationError(this.getNode(), `Couldn't find the field '${fieldToSplitOut}' in the input data`, { description: `If you're trying to use a nested field, make sure you turn off 'disable dot notation' in the node options` }); } else { - throw new NodeOperationError(this.getNode(), `Couldn't find the field '${fieldToSplitOut}' in the input data`); + throw new NodeOperationError(this.getNode(), `Couldn't find the field '${fieldToSplitOut}' in the input data`, { itemIndex: i }); } } if (!Array.isArray(arrayToSplit)) { - throw new NodeOperationError(this.getNode(), `The provided field '${fieldToSplitOut}' is not an array`); + throw new NodeOperationError(this.getNode(), `The provided field '${fieldToSplitOut}' is not an array`, { itemIndex: i }); } else { for (const element of arrayToSplit) { diff --git a/packages/nodes-base/nodes/Iterable/Iterable.node.ts b/packages/nodes-base/nodes/Iterable/Iterable.node.ts index 142944ea4f..a1abeca8fe 100644 --- a/packages/nodes-base/nodes/Iterable/Iterable.node.ts +++ b/packages/nodes-base/nodes/Iterable/Iterable.node.ts @@ -125,7 +125,7 @@ export class Iterable implements INodeType { const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; if (!additionalFields.email && !additionalFields.id) { - throw new NodeOperationError(this.getNode(), 'Either email or userId must be passed in to identify the user. Please add one of both via "Additional Fields". If both are passed in, email takes precedence.'); + throw new NodeOperationError(this.getNode(), 'Either email or userId must be passed in to identify the user. Please add one of both via "Additional Fields". If both are passed in, email takes precedence.', { itemIndex: i }); } const body: IDataObject = { @@ -194,7 +194,7 @@ export class Iterable implements INodeType { if (this.continueOnFail() === false) { if (responseData.code !== 'Success') { throw new NodeOperationError(this.getNode(), - `Iterable error response [400]: ${responseData.msg}`, + `Iterable error response [400]: ${responseData.msg}`, { itemIndex: i } ); } } diff --git a/packages/nodes-base/nodes/Jira/Jira.node.ts b/packages/nodes-base/nodes/Jira/Jira.node.ts index a2d0a08eb6..f5d94d56f2 100644 --- a/packages/nodes-base/nodes/Jira/Jira.node.ts +++ b/packages/nodes-base/nodes/Jira/Jira.node.ts @@ -487,7 +487,7 @@ export class Jira implements INodeType { } if (!additionalFields.parentIssueKey && subtaskIssues.includes(issueTypeId)) { - throw new NodeOperationError(this.getNode(), 'You must define a Parent Issue Key when Issue type is sub-task'); + throw new NodeOperationError(this.getNode(), 'You must define a Parent Issue Key when Issue type is sub-task', { itemIndex: i }); } else if (additionalFields.parentIssueKey && subtaskIssues.includes(issueTypeId)) { @@ -567,7 +567,7 @@ export class Jira implements INodeType { } if (!updateFields.parentIssueKey && subtaskIssues.includes(updateFields.issueType)) { - throw new NodeOperationError(this.getNode(), 'You must define a Parent Issue Key when Issue type is sub-task'); + throw new NodeOperationError(this.getNode(), 'You must define a Parent Issue Key when Issue type is sub-task', { itemIndex: i }); } else if (updateFields.parentIssueKey && subtaskIssues.includes(updateFields.issueType)) { @@ -799,7 +799,7 @@ export class Jira implements INodeType { const issueKey = this.getNodeParameter('issueKey', i) as string; if (items[i].binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const item = items[i].binary as IBinaryKeyData; @@ -808,7 +808,7 @@ export class Jira implements INodeType { const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName); if (binaryData === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex: i }); } responseData = await jiraSoftwareCloudApiRequest.call( @@ -929,7 +929,7 @@ export class Jira implements INodeType { const commentJson = this.getNodeParameter('commentJson', i) as string; const json = validateJSON(commentJson); if (json === '') { - throw new NodeOperationError(this.getNode(), 'Document Format must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Document Format must be a valid JSON', { itemIndex: i }); } Object.assign(body, { body: json }); @@ -1018,7 +1018,7 @@ export class Jira implements INodeType { const commentJson = this.getNodeParameter('commentJson', i) as string; const json = validateJSON(commentJson); if (json === '') { - throw new NodeOperationError(this.getNode(), 'Document Format must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Document Format must be a valid JSON', { itemIndex: i }); } Object.assign(body, { body: json }); diff --git a/packages/nodes-base/nodes/Keap/Keap.node.ts b/packages/nodes-base/nodes/Keap/Keap.node.ts index aa9b66c2e8..70d9317e98 100644 --- a/packages/nodes-base/nodes/Keap/Keap.node.ts +++ b/packages/nodes-base/nodes/Keap/Keap.node.ts @@ -712,7 +712,7 @@ export class Keap implements INodeType { && (attachmentsUi.attachmentsBinary as IDataObject).length) { if (items[i].binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } for (const { property } of attachmentsUi.attachmentsBinary as IDataObject[]) { @@ -720,7 +720,7 @@ export class Keap implements INodeType { const item = items[i].binary as IBinaryKeyData; if (item[property as string] === undefined) { - throw new NodeOperationError(this.getNode(), `Binary data property "${property}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `Binary data property "${property}" does not exists on item!`, { itemIndex: i }); } attachments.push({ @@ -783,13 +783,13 @@ export class Keap implements INodeType { const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string; if (items[i].binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const item = items[i].binary as IBinaryKeyData; if (item[binaryPropertyName as string] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex: i }); } body.file_data = item[binaryPropertyName as string].data; diff --git a/packages/nodes-base/nodes/Kitemaker/Kitemaker.node.ts b/packages/nodes-base/nodes/Kitemaker/Kitemaker.node.ts index 67e24353d0..d0dbbbfae6 100644 --- a/packages/nodes-base/nodes/Kitemaker/Kitemaker.node.ts +++ b/packages/nodes-base/nodes/Kitemaker/Kitemaker.node.ts @@ -247,7 +247,7 @@ export class Kitemaker implements INodeType { }; if (!input.statusId.length) { - throw new NodeOperationError(this.getNode(), 'Please enter a status to set for the work item to create.'); + throw new NodeOperationError(this.getNode(), 'Please enter a status to set for the work item to create.', { itemIndex: i }); } const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; @@ -306,7 +306,7 @@ export class Kitemaker implements INodeType { const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; if (!Object.keys(updateFields).length) { - throw new NodeOperationError(this.getNode(), 'Please enter at least one field to update for the work item.'); + throw new NodeOperationError(this.getNode(), 'Please enter at least one field to update for the work item.', { itemIndex: i }); } Object.assign(input, updateFields); diff --git a/packages/nodes-base/nodes/Line/Line.node.ts b/packages/nodes-base/nodes/Line/Line.node.ts index 53edb82214..acf482d37f 100644 --- a/packages/nodes-base/nodes/Line/Line.node.ts +++ b/packages/nodes-base/nodes/Line/Line.node.ts @@ -109,11 +109,11 @@ export class Line implements INodeType { if (image && image.binaryData === true) { if (items[i].binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } //@ts-ignore if (items[i].binary[image.binaryProperty] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${image.binaryProperty}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${image.binaryProperty}" does not exists on item!`, { itemIndex: i }); } const binaryData = (items[i].binary as IBinaryKeyData)[image.binaryProperty as string]; diff --git a/packages/nodes-base/nodes/LinkedIn/LinkedIn.node.ts b/packages/nodes-base/nodes/LinkedIn/LinkedIn.node.ts index 2fd68fa3ee..2672c9c4c9 100644 --- a/packages/nodes-base/nodes/LinkedIn/LinkedIn.node.ts +++ b/packages/nodes-base/nodes/LinkedIn/LinkedIn.node.ts @@ -139,13 +139,13 @@ export class LinkedIn implements INodeType { const item = items[i]; if (item.binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const propertyNameUpload = this.getNodeParameter('binaryPropertyName', i) as string; if (item.binary[propertyNameUpload] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${propertyNameUpload}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${propertyNameUpload}" does not exists on item!`, { itemIndex: i }); } // Buffer binary data diff --git a/packages/nodes-base/nodes/Mailjet/Mailjet.node.ts b/packages/nodes-base/nodes/Mailjet/Mailjet.node.ts index 05cbe9c192..d57f75baef 100644 --- a/packages/nodes-base/nodes/Mailjet/Mailjet.node.ts +++ b/packages/nodes-base/nodes/Mailjet/Mailjet.node.ts @@ -151,7 +151,7 @@ export class Mailjet implements INodeType { const variablesJson = this.getNodeParameter('variablesJson', i) as string; const parsedJson = validateJSON(variablesJson); if (parsedJson === undefined) { - throw new NodeOperationError(this.getNode(),`Parameter 'Variables (JSON)' has a invalid JSON`); + throw new NodeOperationError(this.getNode(),`Parameter 'Variables (JSON)' has a invalid JSON`, { itemIndex: i }); } body.Variables = parsedJson; } else { @@ -239,7 +239,7 @@ export class Mailjet implements INodeType { const variablesJson = this.getNodeParameter('variablesJson', i) as string; const parsedJson = validateJSON(variablesJson); if (parsedJson === undefined) { - throw new NodeOperationError(this.getNode(), `Parameter 'Variables (JSON)' has a invalid JSON`); + throw new NodeOperationError(this.getNode(), `Parameter 'Variables (JSON)' has a invalid JSON`, { itemIndex: i }); } body.Variables = parsedJson; } else { diff --git a/packages/nodes-base/nodes/Marketstack/Marketstack.node.ts b/packages/nodes-base/nodes/Marketstack/Marketstack.node.ts index 23baa76c68..7afeab1020 100644 --- a/packages/nodes-base/nodes/Marketstack/Marketstack.node.ts +++ b/packages/nodes-base/nodes/Marketstack/Marketstack.node.ts @@ -140,7 +140,7 @@ export class Marketstack implements INodeType { if (!dateFrom || !dateTo) { throw new NodeOperationError( this.getNode(), - 'Please enter a start and end date to filter by timeframe.', + 'Please enter a start and end date to filter by timeframe.', { itemIndex: i } ); } endpoint = '/eod'; diff --git a/packages/nodes-base/nodes/Mattermost/v1/actions/user/getAll/execute.ts b/packages/nodes-base/nodes/Mattermost/v1/actions/user/getAll/execute.ts index 686ae486e6..576c93df02 100644 --- a/packages/nodes-base/nodes/Mattermost/v1/actions/user/getAll/execute.ts +++ b/packages/nodes-base/nodes/Mattermost/v1/actions/user/getAll/execute.ts @@ -56,24 +56,24 @@ export async function getAll(this: IExecuteFunctions, index: number): Promise { const returnValue = name.trim(); if (returnValue.length > 25) { - throw new NodeOperationError(this.getNode(), `The tag "${returnValue}" is to long. Maximum lenght of a tag is 25 characters.`); + throw new NodeOperationError(this.getNode(), `The tag "${returnValue}" is to long. Maximum lenght of a tag is 25 characters.`, { itemIndex: i }); } return returnValue; }); if ((bodyRequest.tags as string[]).length > 5) { - throw new NodeOperationError(this.getNode(), 'To many tags got used. Maximum 5 can be set.'); + throw new NodeOperationError(this.getNode(), 'To many tags got used. Maximum 5 can be set.', { itemIndex: i }); } } diff --git a/packages/nodes-base/nodes/MessageBird/MessageBird.node.ts b/packages/nodes-base/nodes/MessageBird/MessageBird.node.ts index a9b872aa30..75770630ef 100644 --- a/packages/nodes-base/nodes/MessageBird/MessageBird.node.ts +++ b/packages/nodes-base/nodes/MessageBird/MessageBird.node.ts @@ -382,7 +382,7 @@ export class MessageBird implements INodeType { }); } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else if (resource === 'balance') { @@ -390,7 +390,7 @@ export class MessageBird implements INodeType { requestPath = '/balance'; } else { - throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`); + throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i }); } const responseData = await messageBirdApiRequest.call( diff --git a/packages/nodes-base/nodes/Microsoft/GraphSecurity/GenericFunctions.ts b/packages/nodes-base/nodes/Microsoft/GraphSecurity/GenericFunctions.ts index 28bcb312a0..c3003ba827 100644 --- a/packages/nodes-base/nodes/Microsoft/GraphSecurity/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Microsoft/GraphSecurity/GenericFunctions.ts @@ -85,4 +85,4 @@ export function tolerateDoubleQuotes(filterQueryParameter: string) { export function throwOnEmptyUpdate(this: IExecuteFunctions) { throw new NodeOperationError(this.getNode(), 'Please enter at least one field to update'); -} \ No newline at end of file +} diff --git a/packages/nodes-base/nodes/Microsoft/OneDrive/MicrosoftOneDrive.node.ts b/packages/nodes-base/nodes/Microsoft/OneDrive/MicrosoftOneDrive.node.ts index e78eb703b1..e821019970 100644 --- a/packages/nodes-base/nodes/Microsoft/OneDrive/MicrosoftOneDrive.node.ts +++ b/packages/nodes-base/nodes/Microsoft/OneDrive/MicrosoftOneDrive.node.ts @@ -182,11 +182,11 @@ export class MicrosoftOneDrive implements INodeType { const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0) as string; if (items[i].binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } //@ts-ignore if (items[i].binary[binaryPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex: i }); } const binaryData = (items[i].binary as IBinaryKeyData)[binaryPropertyName]; @@ -207,7 +207,7 @@ export class MicrosoftOneDrive implements INodeType { } else { const body = this.getNodeParameter('fileContent', i) as string; if (fileName === '') { - throw new NodeOperationError(this.getNode(), 'File name must be set!'); + throw new NodeOperationError(this.getNode(), 'File name must be set!', { itemIndex: i }); } const encodedFilename = encodeURIComponent(fileName); responseData = await microsoftApiRequest.call(this, 'PUT', `/drive/items/${parentId}:/${encodedFilename}:/content`, body, {}, undefined, { 'Content-Type': 'text/plain' }); diff --git a/packages/nodes-base/nodes/Microsoft/Outlook/MicrosoftOutlook.node.ts b/packages/nodes-base/nodes/Microsoft/Outlook/MicrosoftOutlook.node.ts index 84f246bcab..90e0062226 100644 --- a/packages/nodes-base/nodes/Microsoft/Outlook/MicrosoftOutlook.node.ts +++ b/packages/nodes-base/nodes/Microsoft/Outlook/MicrosoftOutlook.node.ts @@ -270,11 +270,11 @@ export class MicrosoftOutlook implements INodeType { const binaryPropertyName = attachment.binaryPropertyName as string; if (items[i].binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } //@ts-ignore if (items[i].binary[binaryPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex: i }); } const binaryData = (items[i].binary as IBinaryKeyData)[binaryPropertyName]; @@ -380,11 +380,11 @@ export class MicrosoftOutlook implements INodeType { const binaryPropertyName = attachment.binaryPropertyName as string; if (items[i].binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } //@ts-ignore if (items[i].binary[binaryPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex: i }); } const binaryData = (items[i].binary as IBinaryKeyData)[binaryPropertyName]; @@ -590,11 +590,11 @@ export class MicrosoftOutlook implements INodeType { const binaryPropertyName = attachment.binaryPropertyName as string; if (items[i].binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } //@ts-ignore if (items[i].binary[binaryPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex: i }); } const binaryData = (items[i].binary as IBinaryKeyData)[binaryPropertyName]; @@ -644,7 +644,7 @@ export class MicrosoftOutlook implements INodeType { } //@ts-ignore if (items[i].binary[binaryPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex: i }); } const binaryData = (items[i].binary as IBinaryKeyData)[binaryPropertyName]; @@ -653,7 +653,7 @@ export class MicrosoftOutlook implements INodeType { const fileName = additionalFields.fileName === undefined ? binaryData.fileName : additionalFields.fileName; if (!fileName) { - throw new NodeOperationError(this.getNode(), 'File name is not set. It has either to be set via "Additional Fields" or has to be set on the binary property!'); + throw new NodeOperationError(this.getNode(), 'File name is not set. It has either to be set via "Additional Fields" or has to be set on the binary property!', { itemIndex: i }); } // Check if the file is over 3MB big diff --git a/packages/nodes-base/nodes/Microsoft/ToDo/MicrosoftToDo.node.ts b/packages/nodes-base/nodes/Microsoft/ToDo/MicrosoftToDo.node.ts index 8051e46463..ea663be2ed 100644 --- a/packages/nodes-base/nodes/Microsoft/ToDo/MicrosoftToDo.node.ts +++ b/packages/nodes-base/nodes/Microsoft/ToDo/MicrosoftToDo.node.ts @@ -178,7 +178,7 @@ export class MicrosoftToDo implements INodeType { } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not supported!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not supported!`, { itemIndex: i }); } } else if (resource === 'task') { @@ -264,7 +264,7 @@ export class MicrosoftToDo implements INodeType { responseData = await microsoftApiRequest.call(this, 'PATCH', `/todo/lists/${taskListId}/tasks/${taskId}`, body, qs); } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not supported!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not supported!`, { itemIndex: i }); } } else if (resource === 'list') { @@ -314,7 +314,7 @@ export class MicrosoftToDo implements INodeType { responseData = await microsoftApiRequest.call(this, 'PATCH', `/todo/lists/${listId}`, body, qs); } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not supported!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not supported!`, { itemIndex: i }); } } } catch (error) { diff --git a/packages/nodes-base/nodes/Mindee/Mindee.node.ts b/packages/nodes-base/nodes/Mindee/Mindee.node.ts index 723fc07897..e6ed132977 100644 --- a/packages/nodes-base/nodes/Mindee/Mindee.node.ts +++ b/packages/nodes-base/nodes/Mindee/Mindee.node.ts @@ -132,7 +132,7 @@ export class Mindee implements INodeType { const rawData = this.getNodeParameter('rawData', i) as boolean; if (items[i].binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const item = items[i].binary as IBinaryKeyData; @@ -141,7 +141,7 @@ export class Mindee implements INodeType { const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName); if (binaryData === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex: i }); } responseData = await mindeeApiRequest.call( @@ -175,7 +175,7 @@ export class Mindee implements INodeType { const rawData = this.getNodeParameter('rawData', i) as boolean; if (items[i].binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const item = items[i].binary as IBinaryKeyData; @@ -184,7 +184,7 @@ export class Mindee implements INodeType { const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName); if (binaryData === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex: i }); } responseData = await mindeeApiRequest.call( diff --git a/packages/nodes-base/nodes/Mocean/Mocean.node.ts b/packages/nodes-base/nodes/Mocean/Mocean.node.ts index 6fea7da8d8..b06eeb24e1 100644 --- a/packages/nodes-base/nodes/Mocean/Mocean.node.ts +++ b/packages/nodes-base/nodes/Mocean/Mocean.node.ts @@ -293,7 +293,7 @@ export class Mocean implements INodeType { } endpoint = '/rest/2/sms'; } else { - throw new NodeOperationError(this.getNode(), `Unknown resource ${resource}`); + throw new NodeOperationError(this.getNode(), `Unknown resource ${resource}`, { itemIndex }); } if (operation === 'send') { @@ -305,7 +305,7 @@ export class Mocean implements INodeType { } } else { - throw new NodeOperationError(this.getNode(), `Unknown operation ${operation}`); + throw new NodeOperationError(this.getNode(), `Unknown operation ${operation}`, { itemIndex }); } } catch (error) { if (this.continueOnFail()) { diff --git a/packages/nodes-base/nodes/MondayCom/MondayCom.node.ts b/packages/nodes-base/nodes/MondayCom/MondayCom.node.ts index cc6eeaa58c..9f7a64bbfd 100644 --- a/packages/nodes-base/nodes/MondayCom/MondayCom.node.ts +++ b/packages/nodes-base/nodes/MondayCom/MondayCom.node.ts @@ -388,7 +388,7 @@ export class MondayCom implements INodeType { try { JSON.parse(additionalFields.defaults as string); } catch (error) { - throw new NodeOperationError(this.getNode(), 'Defauls must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Defauls must be a valid JSON', { itemIndex: i }); } body.variables.defaults = JSON.stringify(JSON.parse(additionalFields.defaults as string)); } @@ -533,7 +533,7 @@ export class MondayCom implements INodeType { try { JSON.parse(value); } catch (error) { - throw new NodeOperationError(this.getNode(), 'Custom Values must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Custom Values must be a valid JSON', { itemIndex: i }); } body.variables.value = JSON.stringify(JSON.parse(value)); @@ -561,7 +561,7 @@ export class MondayCom implements INodeType { try { JSON.parse(columnValues); } catch (error) { - throw new NodeOperationError(this.getNode(), 'Custom Values must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Custom Values must be a valid JSON', { itemIndex: i }); } body.variables.columnValues = JSON.stringify(JSON.parse(columnValues)); @@ -592,7 +592,7 @@ export class MondayCom implements INodeType { try { JSON.parse(additionalFields.columnValues as string); } catch (error) { - throw new NodeOperationError(this.getNode(), 'Custom Values must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Custom Values must be a valid JSON', { itemIndex: i }); } body.variables.columnValues = JSON.stringify(JSON.parse(additionalFields.columnValues as string)); } diff --git a/packages/nodes-base/nodes/MoveBinaryData/MoveBinaryData.node.ts b/packages/nodes-base/nodes/MoveBinaryData/MoveBinaryData.node.ts index 4966e2b8bf..f380f9c676 100644 --- a/packages/nodes-base/nodes/MoveBinaryData/MoveBinaryData.node.ts +++ b/packages/nodes-base/nodes/MoveBinaryData/MoveBinaryData.node.ts @@ -495,7 +495,7 @@ export class MoveBinaryData implements INodeType { } } } else { - throw new NodeOperationError(this.getNode(), `The operation "${mode}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${mode}" is not known!`, { itemIndex }); } returnData.push(newItem); diff --git a/packages/nodes-base/nodes/Msg91/Msg91.node.ts b/packages/nodes-base/nodes/Msg91/Msg91.node.ts index bc978d506c..448bbf89be 100644 --- a/packages/nodes-base/nodes/Msg91/Msg91.node.ts +++ b/packages/nodes-base/nodes/Msg91/Msg91.node.ts @@ -169,10 +169,10 @@ export class Msg91 implements INodeType { qs.message = this.getNodeParameter('message', i) as string; } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else { - throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`); + throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i }); } const responseData = await msg91ApiRequest.call(this, requestMethod, endpoint, body, qs); diff --git a/packages/nodes-base/nodes/Nasa/Nasa.node.ts b/packages/nodes-base/nodes/Nasa/Nasa.node.ts index 001d402c40..479d0c1d2f 100644 --- a/packages/nodes-base/nodes/Nasa/Nasa.node.ts +++ b/packages/nodes-base/nodes/Nasa/Nasa.node.ts @@ -1008,7 +1008,7 @@ export class Nasa implements INodeType { endpoint = `/neo/rest/v1/neo/${asteroidId}`; } else { - throw new NodeOperationError(this.getNode(), `The operation '${operation}' is unknown!`); + throw new NodeOperationError(this.getNode(), `The operation '${operation}' is unknown!`, { itemIndex: i }); } } @@ -1027,7 +1027,7 @@ export class Nasa implements INodeType { endpoint = `/neo/rest/v1/neo/browse`; } else { - throw new NodeOperationError(this.getNode(), `The operation '${operation}' is unknown!`); + throw new NodeOperationError(this.getNode(), `The operation '${operation}' is unknown!`, { itemIndex: i }); } } diff --git a/packages/nodes-base/nodes/NextCloud/NextCloud.node.ts b/packages/nodes-base/nodes/NextCloud/NextCloud.node.ts index a0b3008eb1..988b1462f4 100644 --- a/packages/nodes-base/nodes/NextCloud/NextCloud.node.ts +++ b/packages/nodes-base/nodes/NextCloud/NextCloud.node.ts @@ -1066,14 +1066,14 @@ export class NextCloud implements INodeType { const item = items[i]; if (item.binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const propertyNameUpload = this.getNodeParameter('binaryPropertyName', i) as string; if (item.binary[propertyNameUpload] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${propertyNameUpload}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${propertyNameUpload}" does not exists on item!`, { itemIndex: i }); } body = await this.helpers.getBinaryDataBuffer(i, propertyNameUpload); @@ -1247,7 +1247,7 @@ export class NextCloud implements INodeType { headers['Content-Type'] = 'application/x-www-form-urlencoded'; } } else { - throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`); + throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i }); } // Make sure that the webdav URL does never have a trailing slash because diff --git a/packages/nodes-base/nodes/NocoDB/NocoDB.node.ts b/packages/nodes-base/nodes/NocoDB/NocoDB.node.ts index 8742b710c6..df9c78784a 100644 --- a/packages/nodes-base/nodes/NocoDB/NocoDB.node.ts +++ b/packages/nodes-base/nodes/NocoDB/NocoDB.node.ts @@ -157,11 +157,11 @@ export class NocoDB implements INodeType { newItem[field.fieldName] = field.fieldValue; } else if (field.binaryProperty) { if (!items[i].binary) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const binaryPropertyName = field.binaryProperty; if (binaryPropertyName && !items[i].binary![binaryPropertyName]) { - throw new NodeOperationError(this.getNode(), `Binary property ${binaryPropertyName} does not exist on item!`); + throw new NodeOperationError(this.getNode(), `Binary property ${binaryPropertyName} does not exist on item!`, { itemIndex: i }); } const binaryData = items[i].binary![binaryPropertyName] as IBinaryData; const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName); @@ -336,11 +336,11 @@ export class NocoDB implements INodeType { newItem[field.fieldName] = field.fieldValue; } else if (field.binaryProperty) { if (!items[i].binary) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const binaryPropertyName = field.binaryProperty; if (binaryPropertyName && !items[i].binary![binaryPropertyName]) { - throw new NodeOperationError(this.getNode(), `Binary property ${binaryPropertyName} does not exist on item!`); + throw new NodeOperationError(this.getNode(), `Binary property ${binaryPropertyName} does not exist on item!`, { itemIndex: i }); } const binaryData = items[i].binary![binaryPropertyName] as IBinaryData; const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName); diff --git a/packages/nodes-base/nodes/OpenWeatherMap/OpenWeatherMap.node.ts b/packages/nodes-base/nodes/OpenWeatherMap/OpenWeatherMap.node.ts index 69d9252a8e..35b646de29 100644 --- a/packages/nodes-base/nodes/OpenWeatherMap/OpenWeatherMap.node.ts +++ b/packages/nodes-base/nodes/OpenWeatherMap/OpenWeatherMap.node.ts @@ -241,7 +241,7 @@ export class OpenWeatherMap implements INodeType { } else if (locationSelection === 'zipCode') { qs.zip = this.getNodeParameter('zipCode', i) as string; } else { - throw new NodeOperationError(this.getNode(), `The locationSelection "${locationSelection}" is not known!`); + throw new NodeOperationError(this.getNode(), `The locationSelection "${locationSelection}" is not known!`, { itemIndex: i }); } // Get the language @@ -263,7 +263,7 @@ export class OpenWeatherMap implements INodeType { endpoint = 'forecast'; } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } const options: OptionsWithUri = { diff --git a/packages/nodes-base/nodes/Paddle/Paddle.node.ts b/packages/nodes-base/nodes/Paddle/Paddle.node.ts index 2f1355cc7d..fdfa11e200 100644 --- a/packages/nodes-base/nodes/Paddle/Paddle.node.ts +++ b/packages/nodes-base/nodes/Paddle/Paddle.node.ts @@ -203,7 +203,7 @@ export class Paddle implements INodeType { if (validateJSON(additionalFieldsJson) !== undefined) { Object.assign(body, JSON.parse(additionalFieldsJson)); } else { - throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON', { itemIndex: i }); } } @@ -288,7 +288,7 @@ export class Paddle implements INodeType { if (validateJSON(additionalFieldsJson) !== undefined) { Object.assign(body, JSON.parse(additionalFieldsJson)); } else { - throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON', { itemIndex: i }); } } @@ -361,7 +361,7 @@ export class Paddle implements INodeType { if (validateJSON(additionalFieldsJson) !== undefined) { Object.assign(body, JSON.parse(additionalFieldsJson)); } else { - throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON', { itemIndex: i }); } } @@ -478,7 +478,7 @@ export class Paddle implements INodeType { if (validateJSON(additionalFieldsJson) !== undefined) { Object.assign(body, JSON.parse(additionalFieldsJson)); } else { - throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON', { itemIndex: i }); } } diff --git a/packages/nodes-base/nodes/PayPal/PayPal.node.ts b/packages/nodes-base/nodes/PayPal/PayPal.node.ts index b0aa0fd707..e6ca3a5c56 100644 --- a/packages/nodes-base/nodes/PayPal/PayPal.node.ts +++ b/packages/nodes-base/nodes/PayPal/PayPal.node.ts @@ -183,7 +183,7 @@ export class PayPal implements INodeType { }); body.items = payoutItems; } else { - throw new NodeOperationError(this.getNode(), 'You must have at least one item.'); + throw new NodeOperationError(this.getNode(), 'You must have at least one item.', { itemIndex: i }); } } else { const itemsJson = validateJSON(this.getNodeParameter('itemsJson', i) as string); diff --git a/packages/nodes-base/nodes/Pipedrive/Pipedrive.node.ts b/packages/nodes-base/nodes/Pipedrive/Pipedrive.node.ts index 8804fb8d81..401478e413 100644 --- a/packages/nodes-base/nodes/Pipedrive/Pipedrive.node.ts +++ b/packages/nodes-base/nodes/Pipedrive/Pipedrive.node.ts @@ -4664,13 +4664,13 @@ export class Pipedrive implements INodeType { const item = items[i]; if (item.binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string; if (item.binary[binaryPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex: i }); } const fileBufferData = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName); @@ -5146,7 +5146,7 @@ export class Pipedrive implements INodeType { } } else { - throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`); + throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i }); } let responseData; diff --git a/packages/nodes-base/nodes/Pushbullet/Pushbullet.node.ts b/packages/nodes-base/nodes/Pushbullet/Pushbullet.node.ts index 0dffe1d3d2..87addbcc45 100644 --- a/packages/nodes-base/nodes/Pushbullet/Pushbullet.node.ts +++ b/packages/nodes-base/nodes/Pushbullet/Pushbullet.node.ts @@ -492,7 +492,7 @@ export class Pushbullet implements INodeType { } //@ts-ignore if (items[i].binary[binaryPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex: i }); } const binaryData = (items[i].binary as IBinaryKeyData)[binaryPropertyName]; diff --git a/packages/nodes-base/nodes/Pushover/Pushover.node.ts b/packages/nodes-base/nodes/Pushover/Pushover.node.ts index 1f0248d03e..4820ac0aaa 100644 --- a/packages/nodes-base/nodes/Pushover/Pushover.node.ts +++ b/packages/nodes-base/nodes/Pushover/Pushover.node.ts @@ -368,7 +368,7 @@ export class Pushover implements INodeType { const binaryPropertyName = attachment.binaryPropertyName as string; if (items[i].binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const item = items[i].binary as IBinaryKeyData; @@ -376,7 +376,7 @@ export class Pushover implements INodeType { const binaryData = item[binaryPropertyName] as IBinaryData; if (binaryData === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex: i }); } const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName); diff --git a/packages/nodes-base/nodes/QuickBase/QuickBase.node.ts b/packages/nodes-base/nodes/QuickBase/QuickBase.node.ts index cb59b895df..f9e3755bc6 100644 --- a/packages/nodes-base/nodes/QuickBase/QuickBase.node.ts +++ b/packages/nodes-base/nodes/QuickBase/QuickBase.node.ts @@ -400,7 +400,7 @@ export class QuickBase implements INodeType { } if (items[i].json[updateKey] === undefined) { - throw new NodeOperationError(this.getNode(), `The update key ${updateKey} could not be found in the input`); + throw new NodeOperationError(this.getNode(), `The update key ${updateKey} could not be found in the input`, { itemIndex: i }); } data.push(record); @@ -475,7 +475,7 @@ export class QuickBase implements INodeType { } if (items[i].json[updateKey] === undefined) { - throw new NodeOperationError(this.getNode(), `The update key ${updateKey} could not be found in the input`); + throw new NodeOperationError(this.getNode(), `The update key ${updateKey} could not be found in the input`, { itemIndex: i }); } record[mergeFieldId] = { value: items[i].json[updateKey] }; diff --git a/packages/nodes-base/nodes/QuickBooks/QuickBooks.node.ts b/packages/nodes-base/nodes/QuickBooks/QuickBooks.node.ts index f4c3026b7a..18dd2488d9 100644 --- a/packages/nodes-base/nodes/QuickBooks/QuickBooks.node.ts +++ b/packages/nodes-base/nodes/QuickBooks/QuickBooks.node.ts @@ -226,18 +226,18 @@ export class QuickBooks implements INodeType { const lines = this.getNodeParameter('Line', i) as IDataObject[]; if (!lines.length) { - throw new NodeOperationError(this.getNode(), `Please enter at least one line for the ${resource}.`); + throw new NodeOperationError(this.getNode(), `Please enter at least one line for the ${resource}.`, { itemIndex: i }); } if (lines.some(line => line.DetailType === undefined || line.Amount === undefined || line.Description === undefined)) { - throw new NodeOperationError(this.getNode(), 'Please enter detail type, amount and description for every line.'); + throw new NodeOperationError(this.getNode(), 'Please enter detail type, amount and description for every line.', { itemIndex: i }); } lines.forEach(line => { if (line.DetailType === 'AccountBasedExpenseLineDetail' && line.accountId === undefined) { - throw new NodeOperationError(this.getNode(), 'Please enter an account ID for the associated line.'); + throw new NodeOperationError(this.getNode(), 'Please enter an account ID for the associated line.', { itemIndex: i }); } else if (line.DetailType === 'ItemBasedExpenseLineDetail' && line.itemId === undefined) { - throw new NodeOperationError(this.getNode(), 'Please enter an item ID for the associated line.'); + throw new NodeOperationError(this.getNode(), 'Please enter an item ID for the associated line.', { itemIndex: i }); } }); @@ -317,7 +317,7 @@ export class QuickBooks implements INodeType { const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; if (isEmpty(updateFields)) { - throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`); + throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i }); } body = populateFields.call(this, body, updateFields, resource); @@ -389,7 +389,7 @@ export class QuickBooks implements INodeType { const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; if (isEmpty(updateFields)) { - throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`); + throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i }); } body = populateFields.call(this, body, updateFields, resource); @@ -460,7 +460,7 @@ export class QuickBooks implements INodeType { const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; if (isEmpty(updateFields)) { - throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`); + throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i }); } body = populateFields.call(this, body, updateFields, resource); @@ -488,16 +488,16 @@ export class QuickBooks implements INodeType { const lines = this.getNodeParameter('Line', i) as IDataObject[]; if (!lines.length) { - throw new NodeOperationError(this.getNode(), `Please enter at least one line for the ${resource}.`); + throw new NodeOperationError(this.getNode(), `Please enter at least one line for the ${resource}.`, { itemIndex: i }); } if (lines.some(line => line.DetailType === undefined || line.Amount === undefined || line.Description === undefined)) { - throw new NodeOperationError(this.getNode(), 'Please enter detail type, amount and description for every line.'); + throw new NodeOperationError(this.getNode(), 'Please enter detail type, amount and description for every line.', { itemIndex: i }); } lines.forEach(line => { if (line.DetailType === 'SalesItemLineDetail' && line.itemId === undefined) { - throw new NodeOperationError(this.getNode(), 'Please enter an item ID for the associated line.'); + throw new NodeOperationError(this.getNode(), 'Please enter an item ID for the associated line.', { itemIndex: i }); } }); @@ -602,7 +602,7 @@ export class QuickBooks implements INodeType { const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; if (isEmpty(updateFields)) { - throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`); + throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i }); } body = populateFields.call(this, body, updateFields, resource); @@ -630,16 +630,16 @@ export class QuickBooks implements INodeType { const lines = this.getNodeParameter('Line', i) as IDataObject[]; if (!lines.length) { - throw new NodeOperationError(this.getNode(), `Please enter at least one line for the ${resource}.`); + throw new NodeOperationError(this.getNode(), `Please enter at least one line for the ${resource}.`, { itemIndex: i }); } if (lines.some(line => line.DetailType === undefined || line.Amount === undefined || line.Description === undefined)) { - throw new NodeOperationError(this.getNode(), 'Please enter detail type, amount and description for every line.'); + throw new NodeOperationError(this.getNode(), 'Please enter detail type, amount and description for every line.', { itemIndex: i }); } lines.forEach(line => { if (line.DetailType === 'SalesItemLineDetail' && line.itemId === undefined) { - throw new NodeOperationError(this.getNode(), 'Please enter an item ID for the associated line.'); + throw new NodeOperationError(this.getNode(), 'Please enter an item ID for the associated line.', { itemIndex: i }); } }); @@ -745,7 +745,7 @@ export class QuickBooks implements INodeType { const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; if (isEmpty(updateFields)) { - throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`); + throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i }); } body = populateFields.call(this, body, updateFields, resource); @@ -917,7 +917,7 @@ export class QuickBooks implements INodeType { const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; if (isEmpty(updateFields)) { - throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`); + throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i }); } body = populateFields.call(this, body, updateFields, resource); @@ -1096,7 +1096,7 @@ export class QuickBooks implements INodeType { const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; if (isEmpty(updateFields)) { - throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`); + throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i }); } body = populateFields.call(this, body, updateFields, resource); diff --git a/packages/nodes-base/nodes/Raindrop/Raindrop.node.ts b/packages/nodes-base/nodes/Raindrop/Raindrop.node.ts index 68ebc80d06..b919e96ee1 100644 --- a/packages/nodes-base/nodes/Raindrop/Raindrop.node.ts +++ b/packages/nodes-base/nodes/Raindrop/Raindrop.node.ts @@ -204,7 +204,7 @@ export class Raindrop implements INodeType { const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; if (isEmpty(updateFields)) { - throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`); + throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`), { itemIndex: i }; } Object.assign(body, updateFields); @@ -317,7 +317,7 @@ export class Raindrop implements INodeType { const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; if (isEmpty(updateFields)) { - throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`); + throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i }); } if (updateFields.parentId) { @@ -336,11 +336,11 @@ export class Raindrop implements INodeType { if (updateFields.cover) { if (!items[i].binary) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } if (!updateFields.cover) { - throw new NodeOperationError(this.getNode(), 'Please enter a binary property to upload a cover image.'); + throw new NodeOperationError(this.getNode(), 'Please enter a binary property to upload a cover image.', { itemIndex: i }); } const binaryPropertyName = updateFields.cover as string; diff --git a/packages/nodes-base/nodes/Rundeck/Rundeck.node.ts b/packages/nodes-base/nodes/Rundeck/Rundeck.node.ts index 24897f605b..63f3fd8b64 100644 --- a/packages/nodes-base/nodes/Rundeck/Rundeck.node.ts +++ b/packages/nodes-base/nodes/Rundeck/Rundeck.node.ts @@ -190,10 +190,10 @@ export class Rundeck implements INodeType { returnData.push(response); } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not supported!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not supported!`, { itemIndex: i }); } } else { - throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not supported!`); + throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not supported!`, { itemIndex: i }); } } diff --git a/packages/nodes-base/nodes/S3/S3.node.ts b/packages/nodes-base/nodes/S3/S3.node.ts index 27c9632e15..99737bf8f4 100644 --- a/packages/nodes-base/nodes/S3/S3.node.ts +++ b/packages/nodes-base/nodes/S3/S3.node.ts @@ -592,11 +592,11 @@ export class S3 implements INodeType { const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0) as string; if (items[i].binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } if ((items[i].binary as IBinaryKeyData)[binaryPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex: i }); } const binaryData = (items[i].binary as IBinaryKeyData)[binaryPropertyName]; diff --git a/packages/nodes-base/nodes/Salesforce/Salesforce.node.ts b/packages/nodes-base/nodes/Salesforce/Salesforce.node.ts index 3cebaa1ac8..8094e0a45b 100644 --- a/packages/nodes-base/nodes/Salesforce/Salesforce.node.ts +++ b/packages/nodes-base/nodes/Salesforce/Salesforce.node.ts @@ -1132,7 +1132,7 @@ export class Salesforce implements INodeType { const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; const body: ILead = {}; if (!Object.keys(updateFields).length) { - throw new NodeOperationError(this.getNode(), 'You must add at least one update field'); + throw new NodeOperationError(this.getNode(), 'You must add at least one update field', { itemIndex: i }); } if (updateFields.lastname !== undefined) { body.LastName = updateFields.lastname as string; @@ -1419,7 +1419,7 @@ export class Salesforce implements INodeType { const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; const body: IContact = {}; if (!Object.keys(updateFields).length) { - throw new NodeOperationError(this.getNode(), 'You must add at least one update field'); + throw new NodeOperationError(this.getNode(), 'You must add at least one update field', { itemIndex: i }); } if (updateFields.lastName !== undefined) { body.LastName = updateFields.lastName as string; @@ -1722,7 +1722,7 @@ export class Salesforce implements INodeType { }; } else { - throw new NodeOperationError(this.getNode(), `The property ${binaryPropertyName} does not exist`); + throw new NodeOperationError(this.getNode(), `The property ${binaryPropertyName} does not exist`, { itemIndex: i }); } responseData = await salesforceApiRequest.call(this, 'POST', '/sobjects/ContentVersion', {}, {}, undefined, { formData: data }); } @@ -2587,7 +2587,7 @@ export class Salesforce implements INodeType { body.Body = items[i].binary![binaryPropertyName].data; body.ContentType = items[i].binary![binaryPropertyName].mimeType; } else { - throw new NodeOperationError(this.getNode(), `The property ${binaryPropertyName} does not exist`); + throw new NodeOperationError(this.getNode(), `The property ${binaryPropertyName} does not exist`, { itemIndex: i }); } if (additionalFields.description !== undefined) { body.Description = additionalFields.description as string; @@ -2611,7 +2611,7 @@ export class Salesforce implements INodeType { body.Body = items[i].binary![binaryPropertyName].data; body.ContentType = items[i].binary![binaryPropertyName].mimeType; } else { - throw new NodeOperationError(this.getNode(), `The property ${binaryPropertyName} does not exist`); + throw new NodeOperationError(this.getNode(), `The property ${binaryPropertyName} does not exist`, { itemIndex: i }); } } if (updateFields.name !== undefined) { diff --git a/packages/nodes-base/nodes/Salesmate/Salesmate.node.ts b/packages/nodes-base/nodes/Salesmate/Salesmate.node.ts index 6b8212f28b..4ae20f7634 100644 --- a/packages/nodes-base/nodes/Salesmate/Salesmate.node.ts +++ b/packages/nodes-base/nodes/Salesmate/Salesmate.node.ts @@ -314,7 +314,7 @@ export class Salesmate implements INodeType { } if (options.fields) { if ((options.fields as string).trim() === '') { - throw new NodeOperationError(this.getNode(), 'You have to add at least one field'); + throw new NodeOperationError(this.getNode(), 'You have to add at least one field', { itemIndex: i }); } body.fields = (options.fields as string).split(',') as string[]; } else { @@ -479,7 +479,7 @@ export class Salesmate implements INodeType { } if (options.fields) { if ((options.fields as string).trim() === '') { - throw new NodeOperationError(this.getNode(), 'You have to add at least one field'); + throw new NodeOperationError(this.getNode(), 'You have to add at least one field', { itemIndex: i }); } body.fields = (options.fields as string).split(',') as string[]; } else { @@ -671,7 +671,7 @@ export class Salesmate implements INodeType { } if (options.fields !== undefined) { if ((options.fields as string).trim() === '') { - throw new NodeOperationError(this.getNode(), 'You have to add at least one field'); + throw new NodeOperationError(this.getNode(), 'You have to add at least one field', { itemIndex: i }); } body.fields = (options.fields as string).split(',') as string[]; } else { diff --git a/packages/nodes-base/nodes/SeaTable/SeaTable.node.ts b/packages/nodes-base/nodes/SeaTable/SeaTable.node.ts index 0cad81514a..e4f922a5cc 100644 --- a/packages/nodes-base/nodes/SeaTable/SeaTable.node.ts +++ b/packages/nodes-base/nodes/SeaTable/SeaTable.node.ts @@ -170,7 +170,7 @@ export class SeaTable implements INodeType { const { _id: insertId } = responseData; if (insertId === undefined) { - throw new NodeOperationError(this.getNode(), 'SeaTable: No identity after appending row.'); + throw new NodeOperationError(this.getNode(), 'SeaTable: No identity after appending row.', { itemIndex: i }); } const newRowInsertData = rowMapKeyToName(responseData, tableColumns); @@ -180,7 +180,7 @@ export class SeaTable implements INodeType { const newRow = await seaTableApiRequest.call(this, ctx, 'GET', `/dtable-server/api/v1/dtables/{{dtable_uuid}}/rows/${encodeURIComponent(insertId)}/`, body, qs); if (newRow._id === undefined) { - throw new NodeOperationError(this.getNode(), 'SeaTable: No identity for appended row.'); + throw new NodeOperationError(this.getNode(), 'SeaTable: No identity for appended row.', { itemIndex: i }); } const row = rowFormatColumns({ ...newRowInsertData, ...newRow }, tableColumns.map(({ name }) => name).concat(['_id', '_ctime', '_mtime'])); diff --git a/packages/nodes-base/nodes/SendGrid/SendGrid.node.ts b/packages/nodes-base/nodes/SendGrid/SendGrid.node.ts index a4139db5f2..8032b2b507 100644 --- a/packages/nodes-base/nodes/SendGrid/SendGrid.node.ts +++ b/packages/nodes-base/nodes/SendGrid/SendGrid.node.ts @@ -451,7 +451,7 @@ export class SendGrid implements INodeType { for (const property of binaryProperties) { if (!items[i].binary?.hasOwnProperty(property)) { - throw new NodeOperationError(this.getNode(), `The binary property ${property} does not exist`); + throw new NodeOperationError(this.getNode(), `The binary property ${property} does not exist`, { itemIndex: i }); } const binaryProperty = items[i].binary![property]; diff --git a/packages/nodes-base/nodes/Sendy/Sendy.node.ts b/packages/nodes-base/nodes/Sendy/Sendy.node.ts index a30991fcb1..37164bdffd 100644 --- a/packages/nodes-base/nodes/Sendy/Sendy.node.ts +++ b/packages/nodes-base/nodes/Sendy/Sendy.node.ts @@ -192,7 +192,7 @@ export class Sendy implements INodeType { if (responseData === '1') { responseData = { success: true }; } else { - throw new NodeOperationError(this.getNode(), `Sendy error response [${400}]: ${responseData}`); + throw new NodeOperationError(this.getNode(), `Sendy error response [${400}]: ${responseData}`, { itemIndex: i }); } } @@ -222,7 +222,7 @@ export class Sendy implements INodeType { if (!errors.includes(responseData)) { responseData = { count: responseData }; } else { - throw new NodeOperationError(this.getNode(), `Sendy error response [${400}]: ${responseData}`); + throw new NodeOperationError(this.getNode(), `Sendy error response [${400}]: ${responseData}`, { itemIndex: i }); } } @@ -247,7 +247,7 @@ export class Sendy implements INodeType { if (responseData === '1') { responseData = { success: true }; } else { - throw new NodeOperationError(this.getNode(), `Sendy error response [${400}]: ${responseData}`); + throw new NodeOperationError(this.getNode(), `Sendy error response [${400}]: ${responseData}`, { itemIndex: i }); } } @@ -272,7 +272,7 @@ export class Sendy implements INodeType { if (responseData === '1') { responseData = { success: true }; } else { - throw new NodeOperationError(this.getNode(), `Sendy error response [${400}]: ${responseData}`); + throw new NodeOperationError(this.getNode(), `Sendy error response [${400}]: ${responseData}`, { itemIndex: i }); } } @@ -306,7 +306,7 @@ export class Sendy implements INodeType { if (status.includes(responseData)) { responseData = { status: responseData }; } else { - throw new NodeOperationError(this.getNode(), `Sendy error response [${400}]: ${responseData}`); + throw new NodeOperationError(this.getNode(), `Sendy error response [${400}]: ${responseData}`, { itemIndex: i }); } } } diff --git a/packages/nodes-base/nodes/ServiceNow/ServiceNow.node.ts b/packages/nodes-base/nodes/ServiceNow/ServiceNow.node.ts index f47d768fab..9f996ca4f0 100644 --- a/packages/nodes-base/nodes/ServiceNow/ServiceNow.node.ts +++ b/packages/nodes-base/nodes/ServiceNow/ServiceNow.node.ts @@ -556,7 +556,7 @@ export class ServiceNow implements INodeType { if (items[i].binary && items[i].binary![inputDataFieldName]) { binaryData = items[i].binary![inputDataFieldName]; } else { - throw new NodeOperationError(this.getNode(), `No binary data property "${inputDataFieldName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${inputDataFieldName}" does not exists on item!`, { itemIndex: i }); } const headers: IDataObject = { @@ -722,7 +722,7 @@ export class ServiceNow implements INodeType { responseData = response.result; } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else if (resource === 'tableRecord') { @@ -816,7 +816,7 @@ export class ServiceNow implements INodeType { responseData = response.result; } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else if (resource === 'user') { @@ -881,7 +881,7 @@ export class ServiceNow implements INodeType { responseData = response.result; } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else if (resource === 'userGroup') { if (operation === 'getAll') { @@ -902,7 +902,7 @@ export class ServiceNow implements INodeType { responseData = await serviceNowRequestAllItems.call(this, 'GET', '/now/table/sys_user_group', {}, qs); } } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else if (resource === 'userRole') { if (operation === 'getAll') { @@ -923,10 +923,10 @@ export class ServiceNow implements INodeType { responseData = await serviceNowRequestAllItems.call(this, 'GET', '/now/table/sys_user_role', {}, qs); } } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else { - throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`); + throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i }); } } catch (error) { if (this.continueOnFail()) { diff --git a/packages/nodes-base/nodes/Shopify/Shopify.node.ts b/packages/nodes-base/nodes/Shopify/Shopify.node.ts index 9a0c147876..88668e5207 100644 --- a/packages/nodes-base/nodes/Shopify/Shopify.node.ts +++ b/packages/nodes-base/nodes/Shopify/Shopify.node.ts @@ -140,7 +140,7 @@ export class Shopify implements INodeType { const shipping = additionalFields.shippingAddressUi as IDataObject; const lineItem = (this.getNodeParameter('limeItemsUi', i) as IDataObject).lineItemValues as IDataObject[]; if (lineItem === undefined) { - throw new NodeOperationError(this.getNode(), 'At least one line item has to be added'); + throw new NodeOperationError(this.getNode(), 'At least one line item has to be added', { itemIndex: i }); } const body: IOrder = { test: true, diff --git a/packages/nodes-base/nodes/Signl4/Signl4.node.ts b/packages/nodes-base/nodes/Signl4/Signl4.node.ts index 52d0fe2e20..92d60db4a3 100644 --- a/packages/nodes-base/nodes/Signl4/Signl4.node.ts +++ b/packages/nodes-base/nodes/Signl4/Signl4.node.ts @@ -305,7 +305,7 @@ export class Signl4 implements INodeType { if (!supportedFileExtension.includes(binaryProperty.fileExtension as string)) { - throw new NodeOperationError(this.getNode(), `Invalid extension, just ${supportedFileExtension.join(',')} are supported}`); + throw new NodeOperationError(this.getNode(), `Invalid extension, just ${supportedFileExtension.join(',')} are supported}`, { itemIndex: i }); } const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(i, propertyName); @@ -318,7 +318,7 @@ export class Signl4 implements INodeType { }; } else { - throw new NodeOperationError(this.getNode(), `Binary property ${propertyName} does not exist on input`); + throw new NodeOperationError(this.getNode(), `Binary property ${propertyName} does not exist on input`, { itemIndex: i }); } } } diff --git a/packages/nodes-base/nodes/Slack/Slack.node.ts b/packages/nodes-base/nodes/Slack/Slack.node.ts index d3f697a7b7..5d079ab995 100644 --- a/packages/nodes-base/nodes/Slack/Slack.node.ts +++ b/packages/nodes-base/nodes/Slack/Slack.node.ts @@ -584,10 +584,10 @@ export class Slack implements INodeType { for (const elementUi of elementsUi) { const element: Element = {}; if (elementUi.actionId === '') { - throw new NodeOperationError(this.getNode(), 'Action ID must be set'); + throw new NodeOperationError(this.getNode(), 'Action ID must be set', { itemIndex: i }); } if (elementUi.text === '') { - throw new NodeOperationError(this.getNode(), 'Text must be set'); + throw new NodeOperationError(this.getNode(), 'Text must be set', { itemIndex: i }); } element.action_id = elementUi.actionId as string; element.type = elementUi.type as string; @@ -664,7 +664,7 @@ export class Slack implements INodeType { text.text = textUi.text as string; block.text = text; } else { - throw new NodeOperationError(this.getNode(), 'Property text must be defined'); + throw new NodeOperationError(this.getNode(), 'Property text must be defined', { itemIndex: i }); } const fieldsUi = (blockUi.fieldsUi as IDataObject).fieldsValues as IDataObject[]; if (fieldsUi) { @@ -759,10 +759,10 @@ export class Slack implements INodeType { const attachmentsJson = this.getNodeParameter('attachmentsJson', i, '') as string; const blocksJson = this.getNodeParameter('blocksJson', i, []) as string; if (attachmentsJson !== '' && validateJSON(attachmentsJson) === undefined) { - throw new NodeOperationError(this.getNode(), 'Attachments it is not a valid json'); + throw new NodeOperationError(this.getNode(), 'Attachments it is not a valid json', { itemIndex: i }); } if (blocksJson !== '' && validateJSON(blocksJson) === undefined) { - throw new NodeOperationError(this.getNode(), 'Blocks it is not a valid json'); + throw new NodeOperationError(this.getNode(), 'Blocks it is not a valid json', { itemIndex: i }); } if (attachmentsJson !== '') { body.attachments = attachmentsJson; @@ -811,7 +811,7 @@ export class Slack implements INodeType { const blocksJson = this.getNodeParameter('blocksJson', i, []) as string; if (blocksJson !== '' && validateJSON(blocksJson) === undefined) { - throw new NodeOperationError(this.getNode(), 'Blocks it is not a valid json'); + throw new NodeOperationError(this.getNode(), 'Blocks it is not a valid json', { itemIndex: i }); } if (blocksJson !== '') { body.blocks = blocksJson; @@ -820,7 +820,7 @@ export class Slack implements INodeType { const attachmentsJson = this.getNodeParameter('attachmentsJson', i, '') as string; if (attachmentsJson !== '' && validateJSON(attachmentsJson) === undefined) { - throw new NodeOperationError(this.getNode(), 'Attachments it is not a valid json'); + throw new NodeOperationError(this.getNode(), 'Attachments it is not a valid json', { itemIndex: i }); } if (attachmentsJson !== '') { @@ -960,7 +960,7 @@ export class Slack implements INodeType { if (items[i].binary === undefined //@ts-ignore || items[i].binary[binaryPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryPropertyName}" does not exists on item!`, { itemIndex: i }); } const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName); body.file = { diff --git a/packages/nodes-base/nodes/SpreadsheetFile/SpreadsheetFile.node.ts b/packages/nodes-base/nodes/SpreadsheetFile/SpreadsheetFile.node.ts index bc0a60a472..9470e64413 100644 --- a/packages/nodes-base/nodes/SpreadsheetFile/SpreadsheetFile.node.ts +++ b/packages/nodes-base/nodes/SpreadsheetFile/SpreadsheetFile.node.ts @@ -358,13 +358,13 @@ export class SpreadsheetFile implements INodeType { } if (workbook.SheetNames.length === 0) { - throw new NodeOperationError(this.getNode(), 'Spreadsheet does not have any sheets!'); + throw new NodeOperationError(this.getNode(), 'Spreadsheet does not have any sheets!', { itemIndex: i }); } let sheetName = workbook.SheetNames[0]; if (options.sheetName) { if (!workbook.SheetNames.includes(options.sheetName as string)) { - throw new NodeOperationError(this.getNode(), `Spreadsheet does not contain sheet called "${options.sheetName}"!`); + throw new NodeOperationError(this.getNode(), `Spreadsheet does not contain sheet called "${options.sheetName}"!`, { itemIndex: i }); } sheetName = options.sheetName as string; } diff --git a/packages/nodes-base/nodes/Ssh/Ssh.node.ts b/packages/nodes-base/nodes/Ssh/Ssh.node.ts index 4bc97f46a5..6d690367f3 100644 --- a/packages/nodes-base/nodes/Ssh/Ssh.node.ts +++ b/packages/nodes-base/nodes/Ssh/Ssh.node.ts @@ -388,7 +388,7 @@ export class Ssh implements INodeType { const item = items[i]; if (item.binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const propertyNameUpload = this.getNodeParameter('binaryPropertyName', i) as string; @@ -396,7 +396,7 @@ export class Ssh implements INodeType { const binaryData = item.binary[propertyNameUpload] as IBinaryData; if (item.binary[propertyNameUpload] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${propertyNameUpload}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${propertyNameUpload}" does not exists on item!`, { itemIndex: i }); } const dataBuffer = await this.helpers.getBinaryDataBuffer(i, propertyNameUpload); diff --git a/packages/nodes-base/nodes/Stackby/Stackby.node.ts b/packages/nodes-base/nodes/Stackby/Stackby.node.ts index 645b431f04..45ddcfd877 100644 --- a/packages/nodes-base/nodes/Stackby/Stackby.node.ts +++ b/packages/nodes-base/nodes/Stackby/Stackby.node.ts @@ -249,7 +249,7 @@ export class Stackby implements INodeType { const record: { [key: string]: any } = {}; for (const column of columnList) { if (items[i].json[column] === undefined) { - throw new NodeOperationError(this.getNode(), `Column ${column} does not exist on input`); + throw new NodeOperationError(this.getNode(), `Column ${column} does not exist on input`, { itemIndex: i }); } else { record[column] = items[i].json[column]; } diff --git a/packages/nodes-base/nodes/Strapi/Strapi.node.ts b/packages/nodes-base/nodes/Strapi/Strapi.node.ts index 2be01e1963..442c6be10d 100644 --- a/packages/nodes-base/nodes/Strapi/Strapi.node.ts +++ b/packages/nodes-base/nodes/Strapi/Strapi.node.ts @@ -170,7 +170,7 @@ export class Strapi implements INodeType { if (query !== undefined) { qs.filters = query; } else { - throw new NodeOperationError(this.getNode(), 'Query must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Query must be a valid JSON', { itemIndex: i }); } } // Publication Option @@ -196,7 +196,7 @@ export class Strapi implements INodeType { if (query !== undefined) { qs._where = query; } else { - throw new NodeOperationError(this.getNode(), 'Query must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Query must be a valid JSON', { itemIndex: i }); } } // Publication Option diff --git a/packages/nodes-base/nodes/Stripe/Stripe.node.ts b/packages/nodes-base/nodes/Stripe/Stripe.node.ts index 59f84cf750..7fb973b837 100644 --- a/packages/nodes-base/nodes/Stripe/Stripe.node.ts +++ b/packages/nodes-base/nodes/Stripe/Stripe.node.ts @@ -268,7 +268,7 @@ export class Stripe implements INodeType { const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; if (isEmpty(updateFields)) { - throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`); + throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i }); } Object.assign(body, adjustChargeFields(updateFields)); @@ -387,7 +387,7 @@ export class Stripe implements INodeType { const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; if (isEmpty(updateFields)) { - throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`); + throw new NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i }); } Object.assign(body, adjustCustomerFields(updateFields)); @@ -471,7 +471,7 @@ export class Stripe implements INodeType { const body = {} as IDataObject; if (type !== 'cardToken') { - throw new NodeOperationError(this.getNode(), 'Only card token creation implemented.'); + throw new NodeOperationError(this.getNode(), 'Only card token creation implemented.', { itemIndex: i }); } body.card = { diff --git a/packages/nodes-base/nodes/Supabase/Supabase.node.ts b/packages/nodes-base/nodes/Supabase/Supabase.node.ts index 36e77af343..49006f02c2 100644 --- a/packages/nodes-base/nodes/Supabase/Supabase.node.ts +++ b/packages/nodes-base/nodes/Supabase/Supabase.node.ts @@ -181,7 +181,7 @@ export class Supabase implements INodeType { const keys = this.getNodeParameter('filters.conditions', i, []) as IDataObject[]; if (!keys.length) { - throw new NodeOperationError(this.getNode(), 'At least one select condition must be defined'); + throw new NodeOperationError(this.getNode(), 'At least one select condition must be defined', { itemIndex: i }); } if (matchType === 'allFilters') { @@ -224,7 +224,7 @@ export class Supabase implements INodeType { let rows; if (!keys.length) { - throw new NodeOperationError(this.getNode(), 'At least one select condition must be defined'); + throw new NodeOperationError(this.getNode(), 'At least one select condition must be defined', { itemIndex: i }); } try { @@ -296,7 +296,7 @@ export class Supabase implements INodeType { const keys = this.getNodeParameter('filters.conditions', i, []) as IDataObject[]; if (!keys.length) { - throw new NodeOperationError(this.getNode(), 'At least one select condition must be defined'); + throw new NodeOperationError(this.getNode(), 'At least one select condition must be defined', { itemIndex: i }); } if (matchType === 'allFilters') { diff --git a/packages/nodes-base/nodes/SyncroMSP/v1/actions/ticket/update/execute.ts b/packages/nodes-base/nodes/SyncroMSP/v1/actions/ticket/update/execute.ts index eb926abecb..696a65e130 100644 --- a/packages/nodes-base/nodes/SyncroMSP/v1/actions/ticket/update/execute.ts +++ b/packages/nodes-base/nodes/SyncroMSP/v1/actions/ticket/update/execute.ts @@ -35,7 +35,7 @@ export async function updateTicket(this: IExecuteFunctions, index: number): Prom }; if (!Object.keys(body).length) { - throw new NodeOperationError(this.getNode(), 'At least one update fields has to be defined'); + throw new NodeOperationError(this.getNode(), 'At least one update fields has to be defined', { itemIndex: index }); } let responseData; diff --git a/packages/nodes-base/nodes/Tapfiliate/Tapfiliate.node.ts b/packages/nodes-base/nodes/Tapfiliate/Tapfiliate.node.ts index 87789107a8..ee8fdf4de2 100644 --- a/packages/nodes-base/nodes/Tapfiliate/Tapfiliate.node.ts +++ b/packages/nodes-base/nodes/Tapfiliate/Tapfiliate.node.ts @@ -177,7 +177,7 @@ export class Tapfiliate implements INodeType { const affiliateId = this.getNodeParameter('affiliateId', i) as string; const metadata = (this.getNodeParameter('metadataUi', i) as IDataObject || {}).metadataValues as IDataObject[] || []; if (metadata.length === 0) { - throw new NodeOperationError(this.getNode(), 'Metadata cannot be empty.'); + throw new NodeOperationError(this.getNode(), 'Metadata cannot be empty.', { itemIndex: i }); } for (const { key, value } of metadata) { await tapfiliateApiRequest.call(this, 'PUT', `/affiliates/${affiliateId}/meta-data/${key}/`, { value }); diff --git a/packages/nodes-base/nodes/Telegram/Telegram.node.ts b/packages/nodes-base/nodes/Telegram/Telegram.node.ts index 88556c468e..d8aa07d51e 100644 --- a/packages/nodes-base/nodes/Telegram/Telegram.node.ts +++ b/packages/nodes-base/nodes/Telegram/Telegram.node.ts @@ -2196,7 +2196,7 @@ export class Telegram implements INodeType { addAdditionalFields.call(this, body, i); } } else { - throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`); + throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i }); } let responseData; diff --git a/packages/nodes-base/nodes/TheHive/TheHive.node.ts b/packages/nodes-base/nodes/TheHive/TheHive.node.ts index 6b20174406..f6dd3692f3 100644 --- a/packages/nodes-base/nodes/TheHive/TheHive.node.ts +++ b/packages/nodes-base/nodes/TheHive/TheHive.node.ts @@ -433,13 +433,13 @@ export class TheHive implements INodeType { const item = items[i]; if (item.binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const binaryPropertyName = artifactvalue.binaryProperty as string; if (item.binary[binaryPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property '${binaryPropertyName}' does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property '${binaryPropertyName}' does not exists on item!`, { itemIndex: i }); } const binaryData = item.binary[binaryPropertyName] as IBinaryData; @@ -719,13 +719,13 @@ export class TheHive implements INodeType { const item = items[i]; if (item.binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const binaryPropertyName = artifactvalue.binaryProperty as string; if (item.binary[binaryPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property '${binaryPropertyName}' does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property '${binaryPropertyName}' does not exists on item!`, { itemIndex: i }); } const binaryData = item.binary[binaryPropertyName] as IBinaryData; @@ -921,13 +921,13 @@ export class TheHive implements INodeType { const item = items[i]; if (item.binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const binaryPropertyName = this.getNodeParameter('binaryProperty', i) as string; if (item.binary[binaryPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property '${binaryPropertyName}' does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property '${binaryPropertyName}' does not exists on item!`, { itemIndex: i }); } const binaryData = item.binary[binaryPropertyName] as IBinaryData; @@ -1878,13 +1878,13 @@ export class TheHive implements INodeType { const item = items[i]; if (item.binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data exists on item!'); + throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i }); } const binaryPropertyName = attachmentValues.binaryProperty as string; if (item.binary[binaryPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property '${binaryPropertyName}' does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property '${binaryPropertyName}' does not exists on item!`, { itemIndex: i }); } const binaryData = item.binary[binaryPropertyName] as IBinaryData; diff --git a/packages/nodes-base/nodes/Trello/Trello.node.ts b/packages/nodes-base/nodes/Trello/Trello.node.ts index 2c03b7fa9b..e586051812 100644 --- a/packages/nodes-base/nodes/Trello/Trello.node.ts +++ b/packages/nodes-base/nodes/Trello/Trello.node.ts @@ -225,7 +225,7 @@ export class Trello implements INodeType { Object.assign(qs, updateFields); } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else if (resource === 'boardMember') { if (operation === 'getAll') { @@ -287,7 +287,7 @@ export class Trello implements INodeType { endpoint = `boards/${id}/members/${idMember}`; } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else if (resource === 'card') { @@ -347,7 +347,7 @@ export class Trello implements INodeType { Object.assign(qs, updateFields); } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else if (resource === 'cardComment') { @@ -395,7 +395,7 @@ export class Trello implements INodeType { endpoint = `cards/${cardId}/actions/${commentId}/comments`; } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else if (resource === 'list') { @@ -496,7 +496,7 @@ export class Trello implements INodeType { Object.assign(qs, updateFields); } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else if (resource === 'attachment') { @@ -561,7 +561,7 @@ export class Trello implements INodeType { const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; Object.assign(qs, additionalFields); } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else if (resource === 'checklist') { @@ -695,7 +695,7 @@ export class Trello implements INodeType { Object.assign(qs, additionalFields); } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else if (resource === 'label') { @@ -798,10 +798,10 @@ export class Trello implements INodeType { endpoint = `/cards/${cardId}/idLabels/${id}`; } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else { - throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`); + throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i }); } diff --git a/packages/nodes-base/nodes/Twilio/Twilio.node.ts b/packages/nodes-base/nodes/Twilio/Twilio.node.ts index 32ed5b682b..5237c6d53a 100644 --- a/packages/nodes-base/nodes/Twilio/Twilio.node.ts +++ b/packages/nodes-base/nodes/Twilio/Twilio.node.ts @@ -282,7 +282,7 @@ export class Twilio implements INodeType { body.To = `whatsapp:${body.To}`; } } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else if (resource === 'call') { if (operation === 'make') { @@ -306,10 +306,10 @@ export class Twilio implements INodeType { body.StatusCallback = this.getNodeParameter('options.statusCallback', i, '') as string; } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else { - throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`); + throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i }); } const responseData = await twilioApiRequest.call(this, requestMethod, endpoint, body, qs); diff --git a/packages/nodes-base/nodes/Twist/Twist.node.ts b/packages/nodes-base/nodes/Twist/Twist.node.ts index db2d6a9935..0ce6e57393 100644 --- a/packages/nodes-base/nodes/Twist/Twist.node.ts +++ b/packages/nodes-base/nodes/Twist/Twist.node.ts @@ -274,7 +274,7 @@ export class Twist implements INodeType { const binaryData = item[binaryProperty] as IBinaryData; if (binaryData === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`, { itemIndex: i }); } const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryProperty); @@ -378,7 +378,7 @@ export class Twist implements INodeType { const binaryData = item[binaryProperty] as IBinaryData; if (binaryData === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`, { itemIndex: i }); } const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryProperty); @@ -452,7 +452,7 @@ export class Twist implements INodeType { const binaryData = item[binaryProperty] as IBinaryData; if (binaryData === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`, { itemIndex: i }); } const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryProperty); @@ -549,7 +549,7 @@ export class Twist implements INodeType { const binaryData = item[binaryProperty] as IBinaryData; if (binaryData === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`, { itemIndex: i }); } const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryProperty); @@ -623,7 +623,7 @@ export class Twist implements INodeType { const binaryData = item[binaryProperty] as IBinaryData; if (binaryData === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`, { itemIndex: i }); } const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryProperty); @@ -726,7 +726,7 @@ export class Twist implements INodeType { const binaryData = item[binaryProperty] as IBinaryData; if (binaryData === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`, { itemIndex: i }); } const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryProperty); diff --git a/packages/nodes-base/nodes/Twitter/GenericFunctions.ts b/packages/nodes-base/nodes/Twitter/GenericFunctions.ts index 7b3d62bee1..a755540f4e 100644 --- a/packages/nodes-base/nodes/Twitter/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Twitter/GenericFunctions.ts @@ -85,7 +85,7 @@ export async function uploadAttachments(this: IExecuteFunctions, binaryPropertie const binaryData = items[i].binary as IBinaryKeyData; if (binaryData === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data set. So file can not be written!'); + throw new NodeOperationError(this.getNode(), 'No binary data set. So file can not be written!', { itemIndex: i }); } if (!binaryData[binaryPropertyName]) { @@ -101,7 +101,7 @@ export async function uploadAttachments(this: IExecuteFunctions, binaryPropertie const isImage = binaryData[binaryPropertyName].mimeType.includes('image'); if (isImage && isAnimatedWebp) { - throw new NodeOperationError(this.getNode(), 'Animated .webp images are not supported use .gif instead'); + throw new NodeOperationError(this.getNode(), 'Animated .webp images are not supported use .gif instead', { itemIndex: i }); } if (isImage) { diff --git a/packages/nodes-base/nodes/UrlScanIo/UrlScanIo.node.ts b/packages/nodes-base/nodes/UrlScanIo/UrlScanIo.node.ts index b7e9dd7b28..0994eeafd4 100644 --- a/packages/nodes-base/nodes/UrlScanIo/UrlScanIo.node.ts +++ b/packages/nodes-base/nodes/UrlScanIo/UrlScanIo.node.ts @@ -144,7 +144,7 @@ export class UrlScanIo implements INodeType { if (tags.length > 10) { throw new NodeOperationError( this.getNode(), - 'Please enter at most 10 tags', + 'Please enter at most 10 tags', { itemIndex: i } ); } diff --git a/packages/nodes-base/nodes/Wekan/Wekan.node.ts b/packages/nodes-base/nodes/Wekan/Wekan.node.ts index ccaad7a4c2..609a52a6cf 100644 --- a/packages/nodes-base/nodes/Wekan/Wekan.node.ts +++ b/packages/nodes-base/nodes/Wekan/Wekan.node.ts @@ -307,7 +307,7 @@ export class Wekan implements INodeType { endpoint = `users/${userId}/boards`; } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else if (resource === 'card') { @@ -397,7 +397,7 @@ export class Wekan implements INodeType { Object.assign(body, updateFields); } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else if (resource === 'cardComment') { @@ -456,7 +456,7 @@ export class Wekan implements INodeType { endpoint = `boards/${boardId}/cards/${cardId}/comments`; } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else if (resource === 'list') { @@ -511,7 +511,7 @@ export class Wekan implements INodeType { endpoint = `boards/${boardId}/lists`; } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else if (resource === 'checklist') { @@ -620,7 +620,7 @@ export class Wekan implements INodeType { } else { - throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i }); } } else if (resource === 'checklistItem') { diff --git a/packages/nodes-base/nodes/WriteBinaryFile/WriteBinaryFile.node.ts b/packages/nodes-base/nodes/WriteBinaryFile/WriteBinaryFile.node.ts index 441dc306d2..81275dfd63 100644 --- a/packages/nodes-base/nodes/WriteBinaryFile/WriteBinaryFile.node.ts +++ b/packages/nodes-base/nodes/WriteBinaryFile/WriteBinaryFile.node.ts @@ -67,11 +67,11 @@ export class WriteBinaryFile implements INodeType { item = items[itemIndex]; if (item.binary === undefined) { - throw new NodeOperationError(this.getNode(), 'No binary data set. So file can not be written!'); + throw new NodeOperationError(this.getNode(), 'No binary data set. So file can not be written!', { itemIndex }); } if (item.binary[dataPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `The binary property "${dataPropertyName}" does not exist. So no file can be written!`); + throw new NodeOperationError(this.getNode(), `The binary property "${dataPropertyName}" does not exist. So no file can be written!`, { itemIndex }); } const newItem: INodeExecutionData = { diff --git a/packages/nodes-base/nodes/Xml/Xml.node.ts b/packages/nodes-base/nodes/Xml/Xml.node.ts index 2cf4d1d186..593adada82 100644 --- a/packages/nodes-base/nodes/Xml/Xml.node.ts +++ b/packages/nodes-base/nodes/Xml/Xml.node.ts @@ -249,7 +249,7 @@ export class Xml implements INodeType { const parser = new Parser(parserOptions); if (item.json[dataPropertyName] === undefined) { - throw new NodeOperationError(this.getNode(), `No json property "${dataPropertyName}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No json property "${dataPropertyName}" does not exists on item!`, { itemIndex }); } // @ts-ignore @@ -267,7 +267,7 @@ export class Xml implements INodeType { }, }); } else { - throw new NodeOperationError(this.getNode(), `The operation "${mode}" is not known!`); + throw new NodeOperationError(this.getNode(), `The operation "${mode}" is not known!`, { itemIndex }); } } catch (error) { if (this.continueOnFail()) { diff --git a/packages/nodes-base/nodes/Zammad/Zammad.node.ts b/packages/nodes-base/nodes/Zammad/Zammad.node.ts index da6ec95ef5..e449f8aef8 100644 --- a/packages/nodes-base/nodes/Zammad/Zammad.node.ts +++ b/packages/nodes-base/nodes/Zammad/Zammad.node.ts @@ -698,7 +698,7 @@ export class Zammad implements INodeType { const article = this.getNodeParameter('article', i) as ZammadTypes.Article; if (!Object.keys(article).length) { - throw new NodeOperationError(this.getNode(), 'Article is required'); + throw new NodeOperationError(this.getNode(), 'Article is required', { itemIndex: i }); } const { diff --git a/packages/nodes-base/nodes/Zendesk/Zendesk.node.ts b/packages/nodes-base/nodes/Zendesk/Zendesk.node.ts index 543071bf5b..944d374424 100644 --- a/packages/nodes-base/nodes/Zendesk/Zendesk.node.ts +++ b/packages/nodes-base/nodes/Zendesk/Zendesk.node.ts @@ -296,7 +296,7 @@ export class Zendesk implements INodeType { Object.assign(body, JSON.parse(additionalFieldsJson)); } else { - throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON', { itemIndex: i }); } } @@ -348,7 +348,7 @@ export class Zendesk implements INodeType { Object.assign(body, JSON.parse(updateFieldsJson)); } else { - throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON', { itemIndex: i }); } } diff --git a/packages/nodes-base/nodes/Zulip/Zulip.node.ts b/packages/nodes-base/nodes/Zulip/Zulip.node.ts index 8d8d131429..1de4968bd3 100644 --- a/packages/nodes-base/nodes/Zulip/Zulip.node.ts +++ b/packages/nodes-base/nodes/Zulip/Zulip.node.ts @@ -214,7 +214,7 @@ export class Zulip implements INodeType { } //@ts-ignore if (items[i].binary[binaryProperty] === undefined) { - throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`); + throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`, { itemIndex: i }); } const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryProperty); @@ -285,7 +285,7 @@ export class Zulip implements INodeType { if (validateJSON(additionalFieldsJson) !== undefined) { Object.assign(body, JSON.parse(additionalFieldsJson)); } else { - throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON', { itemIndex: i }); } } @@ -344,7 +344,7 @@ export class Zulip implements INodeType { Object.assign(body, JSON.parse(additionalFieldsJson)); } else { - throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON'); + throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON', { itemIndex: i }); } }