diff --git a/packages/nodes-base/nodes/ActionNetwork/ActionNetwork.node.ts b/packages/nodes-base/nodes/ActionNetwork/ActionNetwork.node.ts index 0d0dce6f41f68..259a4528e877f 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 a9fad6867056d..d4d5957e7f6e4 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 2b164e768bcaa..6461e22fe1061 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 035503ccc9249..c5a6ce9033055 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 4c7678dcdba55..96f9b05e3e189 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 db9c89bfccd41..8a35569a016d2 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 b98b49ba24c7f..71ca162565ada 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 02f23831329ad..ba478456f0a47 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 1cbdc05676422..cd094e881df3f 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 cb17234cb8e0f..90c260ff26d99 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 be6406848b053..c9c711d671c46 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 311b9001d229b..0ddec67dadf09 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 075a94ec3773b..abf9c91cabc59 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 6d2427f2fe482..2077e504aa7ab 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 74c08a4a44949..5eaf3908cf7ee 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 18ab4404deb1c..13a68af67e19a 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 5aaec388ca6bb..29cbbe84b4a53 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 467974fb632d9..af14c7147a3f5 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 6e516485f2112..442b643cc8672 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 45cadd0da1be8..bcd1a43b78976 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 7df1c4e9b529f..2806f38826ee6 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 b18d24e30f072..bfe65233cdf7b 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 f47ac64c951ba..da9a3d87cd4e9 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 1160c29c12f96..b75870a90d6b4 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 9272c693029b6..00cd20452d0d7 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 8a9ad7e9034fd..ae205afa6b14a 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 afa214fd81e9a..a74c5e9507f15 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 04561369cc516..38488f2490294 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 b197cade2df02..2a0a4512faf33 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 d89057ba5a9f7..6b6cf21a002f7 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 f115e1c010acf..25548422f3d9e 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 7a6a00b1ee5e7..62dca17344e83 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 52bf4426afd6d..2a28687eea3a5 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 209fa707b2e51..7a9222606be57 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 0d756ecf80d92..c7ee3002f47fc 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 3c2f4afaf4067..1194311264e9e 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 537fe117bf7da..0fb308ba7da8c 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 cfa0393532050..d716835b0f461 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 80c850afb6bfd..1bc69225174fe 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 31f40e7b861ac..e33eedaee3e29 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 a7e0d34b1286e..47bfe136d9818 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 d8b43ca0dc1b6..47a549814e2bb 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 64cbd140fb4ca..4b3fcd98ed115 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 c32b9a49db12a..f9b4b96ec1604 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 8b00c92d6b314..bb036edbd4be3 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 8d0447ca90f92..a7f04b2359f3b 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 9d9daed5455ec..b6c1d1e6010b9 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 b19453870cd29..f1be7f1d6d5cd 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 7d61824dab8f2..c3a6576c75439 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 501f179f0a4c1..93cffa1ef72d8 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 89da4cfe7013d..56c1baec031c4 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 cef600fae0ced..f73e38f128996 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 142944ea4f7f2..a1abeca8fe143 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 a2d0a08eb6f9e..f5d94d56f268b 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 aa9b66c2e8214..70d9317e987c0 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 67e24353d0820..d0dbbbfae61fd 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 53edb8221465c..acf482d37f5f0 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 2fd68fa3eec7a..2672c9c4c934a 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 05cbe9c192014..d57f75baeff89 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 23baa76c683f9..7afeab10206f3 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 686ae486e6b75..576c93df025bb 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 a9b872aa30b41..75770630efa37 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 28bcb312a0f7a..c3003ba827ab3 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 e78eb703b186d..e821019970d18 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 84f246bcab843..90e006222649b 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 8051e46463c53..ea663be2ed007 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 723fc07897136..e6ed132977f00 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 6fea7da8d83c9..b06eeb24e1f93 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 cc6eeaa58cf94..9f7a64bbfd868 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 4966e2b8bfc55..f380f9c67617f 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 bc978d506ccd7..448bbf89beefd 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 001d402c4018b..479d0c1d2fd97 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 a0b3008eb11f5..988b1462f4c5b 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 8742b710c6348..df9c78784a25b 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 69d9252a8e9ac..35b646de29b95 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 2f1355cc7df1c..fdfa11e200a7f 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 b0aa0fd707494..e6ca3a5c56846 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 8804fb8d817f9..401478e413eb2 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 0dffe1d3d269c..87addbcc45c0c 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 1f0248d03e4b5..4820ac0aaa456 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 cb59b895df00c..f9e3755bc6f76 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 f4c3026b7af7d..18dd2488d9de5 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 68ebc80d06e31..b919e96ee1bf9 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 24897f605b5a0..63f3fd8b64b42 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 27c9632e155d8..99737bf8f4661 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 3cebaa1ac8586..8094e0a45bb2b 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 6b8212f28b7ff..4ae20f763458c 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 0cad81514ab6e..e4f922a5cc15d 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 a4139db5f2490..8032b2b5071df 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 a30991fcb1621..37164bdffdabc 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 f47d768fabb1e..9f996ca4f0af9 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 9a0c147876632..88668e52075df 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 52d0fe2e20fb9..92d60db4a3c97 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 d3f697a7b7cd1..5d079ab995f57 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 bc0a60a4722e4..9470e64413b76 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 4bc97f46a5739..6d690367f3fd7 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 645b431f04e0f..45ddcfd87704e 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 2be01e196364b..442c6be10d409 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 59f84cf7504cd..7fb973b837986 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 36e77af343add..49006f02c2052 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 eb926abecb8d3..696a65e1300f7 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 87789107a8988..ee8fdf4de22a2 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 88556c468e48a..d8aa07d51e574 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 6b20174406554..f6dd3692f34b0 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 2c03b7fa9b608..e586051812ad7 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 32ed5b682b92d..5237c6d53af71 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 db2d6a9935eb4..0ce6e57393c26 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 7b3d62bee1340..a755540f4e1bb 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 b7e9dd7b28c74..0994eeafd486c 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 ccaad7a4c28a3..609a52a6cfeca 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 441dc306d2039..81275dfd632ff 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 2cf4d1d1860c0..593adada82a6a 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 da6ec95ef5389..e449f8aef8008 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 543071bf5b519..944d374424738 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 8d8d131429b5d..1de4968bd38dd 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 }); } }