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

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