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
117 changed files with 376 additions and 370 deletions

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;