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

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