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:
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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' });
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user