From 67b866f9426469b4ffe317f93bc98914c6140ec3 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 27 Aug 2024 11:46:23 +0300 Subject: [PATCH 1/3] Extend connection refused error processing --- workers/loc.api/helpers/api-errors-testers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workers/loc.api/helpers/api-errors-testers.js b/workers/loc.api/helpers/api-errors-testers.js index 04a8fa78..92b51192 100644 --- a/workers/loc.api/helpers/api-errors-testers.js +++ b/workers/loc.api/helpers/api-errors-testers.js @@ -48,7 +48,7 @@ const isEAiAgainError = (err) => { } const isEConnRefusedError = (err) => { - return /ECONNREFUSED/i.test(_getErrorString(err)) + return /(ECONNREFUSED)|(ERR_CONNECTION_REFUSED)/i.test(_getErrorString(err)) } const isENotFoundError = (err) => { From 677e86e6960c4116992d5fc255cb4c9b79a53943 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 27 Aug 2024 11:48:23 +0300 Subject: [PATCH 2/3] Add connection closed error processing --- workers/loc.api/helpers/api-errors-testers.js | 6 ++++++ workers/loc.api/helpers/index.js | 2 ++ 2 files changed, 8 insertions(+) diff --git a/workers/loc.api/helpers/api-errors-testers.js b/workers/loc.api/helpers/api-errors-testers.js index 92b51192..5ad9cc38 100644 --- a/workers/loc.api/helpers/api-errors-testers.js +++ b/workers/loc.api/helpers/api-errors-testers.js @@ -51,6 +51,10 @@ const isEConnRefusedError = (err) => { return /(ECONNREFUSED)|(ERR_CONNECTION_REFUSED)/i.test(_getErrorString(err)) } +const isEConnClosedError = (err) => { + return /ERR_CONNECTION_CLOSED/i.test(_getErrorString(err)) +} + const isENotFoundError = (err) => { return /ENOTFOUND/i.test(_getErrorString(err)) } @@ -87,6 +91,7 @@ const isENetError = (err) => ( isNodeFetchTimeoutError(err) || isEAiAgainError(err) || isEConnRefusedError(err) || + isEConnClosedError(err) || isENotFoundError(err) || isESocketTimeoutError(err) || isEHostUnreachError(err) || @@ -106,6 +111,7 @@ module.exports = { isNodeFetchTimeoutError, isEAiAgainError, isEConnRefusedError, + isEConnClosedError, isENotFoundError, isESocketTimeoutError, isEHostUnreachError, diff --git a/workers/loc.api/helpers/index.js b/workers/loc.api/helpers/index.js index add351b3..2020d546 100644 --- a/workers/loc.api/helpers/index.js +++ b/workers/loc.api/helpers/index.js @@ -34,6 +34,7 @@ const { isNodeFetchTimeoutError, isEAiAgainError, isEConnRefusedError, + isEConnClosedError, isENotFoundError, isESocketTimeoutError, isENetError, @@ -81,6 +82,7 @@ module.exports = { isNodeFetchTimeoutError, isEAiAgainError, isEConnRefusedError, + isEConnClosedError, isENotFoundError, isESocketTimeoutError, isENetError, From 1f783508f3beeb1f402efba7aa987c68d7a8446d Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 27 Aug 2024 11:55:06 +0300 Subject: [PATCH 3/3] Add Bad Gateway error processing --- workers/loc.api/helpers/api-errors-testers.js | 8 +++++++- workers/loc.api/helpers/index.js | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/workers/loc.api/helpers/api-errors-testers.js b/workers/loc.api/helpers/api-errors-testers.js index 5ad9cc38..f6b50a69 100644 --- a/workers/loc.api/helpers/api-errors-testers.js +++ b/workers/loc.api/helpers/api-errors-testers.js @@ -75,6 +75,10 @@ const isTempUnavailableError = (err) => { return /temporarily_unavailable/i.test(_getErrorString(err)) } +const isBadGatewayError = (err) => { + return /Bad Gateway/i.test(_getErrorString(err)) +} + const isForbiddenError = (err) => { return /forbidden/i.test(_getErrorString(err)) } @@ -96,7 +100,8 @@ const isENetError = (err) => ( isESocketTimeoutError(err) || isEHostUnreachError(err) || isEProtoError(err) || - isTempUnavailableError(err) + isTempUnavailableError(err) || + isBadGatewayError(err) ) module.exports = { @@ -117,6 +122,7 @@ module.exports = { isEHostUnreachError, isEProtoError, isTempUnavailableError, + isBadGatewayError, isENetError, isForbiddenError, isMaintenanceError diff --git a/workers/loc.api/helpers/index.js b/workers/loc.api/helpers/index.js index 2020d546..6f55dc03 100644 --- a/workers/loc.api/helpers/index.js +++ b/workers/loc.api/helpers/index.js @@ -37,6 +37,10 @@ const { isEConnClosedError, isENotFoundError, isESocketTimeoutError, + isEHostUnreachError, + isEProtoError, + isTempUnavailableError, + isBadGatewayError, isENetError, isForbiddenError, isMaintenanceError @@ -85,6 +89,10 @@ module.exports = { isEConnClosedError, isENotFoundError, isESocketTimeoutError, + isEHostUnreachError, + isEProtoError, + isTempUnavailableError, + isBadGatewayError, isENetError, isForbiddenError, isMaintenanceError,