From c3d5416d2510b9fd6a27ba384eb89fafecf6c763 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 2 Sep 2024 07:28:57 +0300 Subject: [PATCH] Add socket hang up error processing --- workers/loc.api/helpers/api-errors-testers.js | 8 +++++++- workers/loc.api/helpers/index.js | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/workers/loc.api/helpers/api-errors-testers.js b/workers/loc.api/helpers/api-errors-testers.js index 0e43fa7a..27a5a8c3 100644 --- a/workers/loc.api/helpers/api-errors-testers.js +++ b/workers/loc.api/helpers/api-errors-testers.js @@ -83,6 +83,10 @@ const isDNSAvailabilityError = (err) => { return /ERR_NAME_NOT_RESOLVED/i.test(_getErrorString(err)) } +const isSocketHangUpError = (err) => { + return /socket hang up/i.test(_getErrorString(err)) +} + const isForbiddenError = (err) => { return /forbidden/i.test(_getErrorString(err)) } @@ -106,7 +110,8 @@ const isENetError = (err) => ( isEProtoError(err) || isTempUnavailableError(err) || isBadGatewayError(err) || - isDNSAvailabilityError(err) + isDNSAvailabilityError(err) || + isSocketHangUpError(err) ) module.exports = { @@ -129,6 +134,7 @@ module.exports = { isTempUnavailableError, isBadGatewayError, isDNSAvailabilityError, + isSocketHangUpError, isENetError, isForbiddenError, isMaintenanceError diff --git a/workers/loc.api/helpers/index.js b/workers/loc.api/helpers/index.js index f498eb9d..63825600 100644 --- a/workers/loc.api/helpers/index.js +++ b/workers/loc.api/helpers/index.js @@ -42,6 +42,7 @@ const { isTempUnavailableError, isBadGatewayError, isDNSAvailabilityError, + isSocketHangUpError, isENetError, isForbiddenError, isMaintenanceError @@ -95,6 +96,7 @@ module.exports = { isTempUnavailableError, isBadGatewayError, isDNSAvailabilityError, + isSocketHangUpError, isENetError, isForbiddenError, isMaintenanceError,