From 0d7fdc023ff6824af3af634f13d62cfc43476b05 Mon Sep 17 00:00:00 2001 From: Jan Oberhauser <janober@users.noreply.github.com> Date: Tue, 18 Apr 2023 11:48:38 +0200 Subject: [PATCH] fix(HTTP Request Node): Fix itemIndex in HTTP Request errors (#5991) --- .../nodes-base/nodes/HttpRequest/V1/HttpRequestV1.node.ts | 2 +- .../nodes-base/nodes/HttpRequest/V2/HttpRequestV2.node.ts | 2 +- .../nodes-base/nodes/HttpRequest/V3/HttpRequestV3.node.ts | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/nodes-base/nodes/HttpRequest/V1/HttpRequestV1.node.ts b/packages/nodes-base/nodes/HttpRequest/V1/HttpRequestV1.node.ts index 7b989d6611b4b..e5971875d686a 100644 --- a/packages/nodes-base/nodes/HttpRequest/V1/HttpRequestV1.node.ts +++ b/packages/nodes-base/nodes/HttpRequest/V1/HttpRequestV1.node.ts @@ -967,7 +967,7 @@ export class HttpRequestV1 implements INodeType { if (response!.status !== 'fulfilled') { if (!this.continueOnFail()) { // throw error; - throw new NodeApiError(this.getNode(), response as JsonObject); + throw new NodeApiError(this.getNode(), response as JsonObject, { itemIndex }); } else { // Return the actual reason as error returnItems.push({ diff --git a/packages/nodes-base/nodes/HttpRequest/V2/HttpRequestV2.node.ts b/packages/nodes-base/nodes/HttpRequest/V2/HttpRequestV2.node.ts index b136dbf1eb99c..69d9d3d11b52a 100644 --- a/packages/nodes-base/nodes/HttpRequest/V2/HttpRequestV2.node.ts +++ b/packages/nodes-base/nodes/HttpRequest/V2/HttpRequestV2.node.ts @@ -1019,7 +1019,7 @@ export class HttpRequestV2 implements INodeType { if (response!.status !== 'fulfilled') { if (!this.continueOnFail()) { // throw error; - throw new NodeApiError(this.getNode(), response as JsonObject); + throw new NodeApiError(this.getNode(), response as JsonObject, { itemIndex }); } else { // Return the actual reason as error returnItems.push({ diff --git a/packages/nodes-base/nodes/HttpRequest/V3/HttpRequestV3.node.ts b/packages/nodes-base/nodes/HttpRequest/V3/HttpRequestV3.node.ts index 0618bd957f9fc..f515b7ab2adb4 100644 --- a/packages/nodes-base/nodes/HttpRequest/V3/HttpRequestV3.node.ts +++ b/packages/nodes-base/nodes/HttpRequest/V3/HttpRequestV3.node.ts @@ -1176,7 +1176,7 @@ export class HttpRequestV3 implements INodeType { this.getNode(), 'JSON parameter need to be an valid JSON', { - runIndex: itemIndex, + itemIndex, }, ); } @@ -1242,7 +1242,7 @@ export class HttpRequestV3 implements INodeType { this.getNode(), 'JSON parameter need to be an valid JSON', { - runIndex: itemIndex, + itemIndex, }, ); } @@ -1264,7 +1264,7 @@ export class HttpRequestV3 implements INodeType { this.getNode(), 'JSON parameter need to be an valid JSON', { - runIndex: itemIndex, + itemIndex, }, ); } @@ -1381,7 +1381,7 @@ export class HttpRequestV3 implements INodeType { if (autoDetectResponseFormat && response.reason.error instanceof Buffer) { response.reason.error = Buffer.from(response.reason.error as Buffer).toString(); } - throw new NodeApiError(this.getNode(), response as JsonObject); + throw new NodeApiError(this.getNode(), response as JsonObject, { itemIndex }); } else { // Return the actual reason as error returnItems.push({