feat: Add item information to more node errors (#3681)

*  Add `itemIndex` to node-thrown errors

*  Add some missing item indexes
This commit is contained in:
Iván Ovejero 2022-07-12 17:51:01 +02:00 committed by GitHub
parent a847190f33
commit 2a8043cd27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
117 changed files with 376 additions and 370 deletions

View file

@ -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 },
);
}

View file

@ -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;

View file

@ -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 });
}
}

View file

@ -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 });
}
}

View file

@ -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];

View file

@ -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];

View file

@ -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) {

View file

@ -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;

View file

@ -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];

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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);
}

View file

@ -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 = {

View file

@ -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;

View file

@ -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;
}

View file

@ -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];

View file

@ -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);

View file

@ -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 {

View file

@ -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)) {

View file

@ -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 });
}
}

View file

@ -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()) {

View file

@ -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') {

View file

@ -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 => {

View file

@ -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();

View file

@ -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 = {};

View file

@ -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);

View file

@ -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(

View file

@ -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 } });

View file

@ -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});
}

View file

@ -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') {

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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}`;

View file

@ -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) {

View file

@ -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 });
}
}

View file

@ -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) {

View file

@ -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) {

View file

@ -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 }
);
}

View file

@ -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) {

View file

@ -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 });
}
}

View file

@ -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 });
}

View file

@ -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()) {

View file

@ -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[]);

View file

@ -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);

View file

@ -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:<code>"sendKey1:binaryProperty1,sendKey2:binaryProperty2"</code>');
throw new NodeOperationError(this.getNode(), 'If more than one property should be send it is needed to define the in the format:<code>"sendKey1:binaryProperty1,sendKey2:binaryProperty2"</code>', { 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 });
}
}

View file

@ -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 }
);
}

View file

@ -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(

View file

@ -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 });
}
}
}

View file

@ -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) {

View file

@ -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 }
);
}
}

View file

@ -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 });

View file

@ -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;

View file

@ -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);

View file

@ -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];

View file

@ -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

View file

@ -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 {

View file

@ -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';

View file

@ -56,24 +56,24 @@ export async function getAll(this: IExecuteFunctions, index: number): Promise<IN
if (additionalFields.inTeam !== undefined
&& !validRules.inTeam.includes(snakeCase(additionalFields.sort as string))) {
throw new NodeOperationError(this.getNode(), `When In Team is set the only valid values for sorting are ${validRules.inTeam.join(',')}`);
throw new NodeOperationError(this.getNode(), `When In Team is set the only valid values for sorting are ${validRules.inTeam.join(',')}`, { itemIndex: index });
}
if (additionalFields.inChannel !== undefined
&& !validRules.inChannel.includes(snakeCase(additionalFields.sort as string))) {
throw new NodeOperationError(this.getNode(), `When In Channel is set the only valid values for sorting are ${validRules.inChannel.join(',')}`);
throw new NodeOperationError(this.getNode(), `When In Channel is set the only valid values for sorting are ${validRules.inChannel.join(',')}`, { itemIndex: index });
}
if (additionalFields.inChannel === ''
&& additionalFields.sort !== 'username') {
throw new NodeOperationError(this.getNode(), 'When sort is different than username In Channel must be set');
throw new NodeOperationError(this.getNode(), 'When sort is different than username In Channel must be set', { itemIndex: index });
}
if (additionalFields.inTeam === ''
&& additionalFields.sort !== 'username') {
throw new NodeOperationError(this.getNode(), 'When sort is different than username In Team must be set');
throw new NodeOperationError(this.getNode(), 'When sort is different than username In Team must be set', { itemIndex: index });
}
} else {
throw new NodeOperationError(this.getNode(), `When sort is defined either 'in team' or 'in channel' must be defined`);
throw new NodeOperationError(this.getNode(), `When sort is defined either 'in team' or 'in channel' must be defined`, { itemIndex: index });
}
}
@ -95,4 +95,4 @@ export async function getAll(this: IExecuteFunctions, index: number): Promise<IN
}
return this.helpers.returnJsonArray(responseData);
}
}

View file

@ -629,7 +629,7 @@ export class Mautic implements INodeType {
if (json !== undefined) {
body = { ...json };
} else {
throw new NodeOperationError(this.getNode(), 'Invalid JSON');
throw new NodeOperationError(this.getNode(), 'Invalid JSON', { itemIndex: i });
}
}
if (additionalFields.ipAddress) {
@ -738,7 +738,7 @@ export class Mautic implements INodeType {
if (json !== undefined) {
body = { ...json };
} else {
throw new NodeOperationError(this.getNode(), 'Invalid JSON');
throw new NodeOperationError(this.getNode(), 'Invalid JSON', { itemIndex: i });
}
}
if (updateFields.ipAddress) {

View file

@ -478,13 +478,13 @@ export class Medium implements INodeType {
bodyRequest.tags = tags.split(',').map(name => {
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 });
}
}

View file

@ -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(

View file

@ -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');
}
}

View file

@ -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' });

View file

@ -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

View file

@ -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) {

View file

@ -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(

View file

@ -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()) {

View file

@ -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));
}

View file

@ -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);

View file

@ -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);

View file

@ -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 });
}
}

View file

@ -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

View file

@ -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);

View file

@ -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 = {

View file

@ -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 });
}
}

View file

@ -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);

View file

@ -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;

View file

@ -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];

View file

@ -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);

View file

@ -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] };

View file

@ -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);

View file

@ -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;

View file

@ -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 });
}
}

View file

@ -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];

View file

@ -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) {

View file

@ -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 {

View file

@ -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']));

View file

@ -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];

View file

@ -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 });
}
}
}

View file

@ -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()) {

View file

@ -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,

View file

@ -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 });
}
}
}

View file

@ -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 = {

View file

@ -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;
}

View file

@ -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);

View file

@ -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];
}

View file

@ -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

Some files were not shown because too many files have changed in this diff Show more