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