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

@@ -423,7 +423,7 @@ export class Intercom implements INodeType {
try {
responseData = await intercomApiRequest.call(this, `/users/${id}`, 'DELETE');
} catch (error) {
throw new NodeOperationError(this.getNode(), `Intercom Error: ${JSON.stringify(error)}`);
throw new NodeOperationError(this.getNode(), `Intercom Error: ${JSON.stringify(error)}`, { itemIndex: i });
}
}
}
@@ -473,7 +473,7 @@ export class Intercom implements INodeType {
try {
responseData = await intercomApiRequest.call(this, '/companies', 'POST', body, qs);
} catch (error) {
throw new NodeOperationError(this.getNode(), `Intercom Error: ${JSON.stringify(error)}`);
throw new NodeOperationError(this.getNode(), `Intercom Error: ${JSON.stringify(error)}`, { itemIndex: i });
}
}
if (operation === 'get') {
@@ -492,7 +492,7 @@ export class Intercom implements INodeType {
responseData = await intercomApiRequest.call(this, '/companies', 'GET', {}, qs);
}
} catch (error) {
throw new NodeOperationError(this.getNode(), `Intercom Error: ${JSON.stringify(error)}`);
throw new NodeOperationError(this.getNode(), `Intercom Error: ${JSON.stringify(error)}`, { itemIndex: i });
}
}
if (operation === 'getAll') {
@@ -509,7 +509,7 @@ export class Intercom implements INodeType {
responseData = responseData.companies;
}
} catch (error) {
throw new NodeOperationError(this.getNode(), `Intercom Error: ${JSON.stringify(error)}`);
throw new NodeOperationError(this.getNode(), `Intercom Error: ${JSON.stringify(error)}`, { itemIndex: i });
}
}
if (operation === 'users') {
@@ -543,7 +543,7 @@ export class Intercom implements INodeType {
}
}
} catch (error) {
throw new NodeOperationError(this.getNode(), `Intercom Error: ${JSON.stringify(error)}`);
throw new NodeOperationError(this.getNode(), `Intercom Error: ${JSON.stringify(error)}`, { itemIndex: i });
}
}
}