From cdc1c12966cd3dc64a7cb3f38399c9a9b7f09be1 Mon Sep 17 00:00:00 2001 From: Michael Chappell <7581002+mchappell@users.noreply.github.com> Date: Tue, 14 Jan 2025 13:24:59 +0200 Subject: [PATCH] fix: prevent displaying poor connection pill for 404 responses (#1642) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Szymon Masłowski --- .../src/lib/scripts/background/onError.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/browser-extension-wallet/src/lib/scripts/background/onError.ts b/apps/browser-extension-wallet/src/lib/scripts/background/onError.ts index 1534f42bf..919d3ba26 100644 --- a/apps/browser-extension-wallet/src/lib/scripts/background/onError.ts +++ b/apps/browser-extension-wallet/src/lib/scripts/background/onError.ts @@ -6,10 +6,15 @@ import { backendFailures$, requestMessage$ } from './services'; const INTERNAL_SERVER_ERROR_STATUS_CODE = 500; const GATEWAY_TIMEOUT_STATUS_CODE = 503; const UNAUTHORIZED_STATUS_CODE = 401; +const NOT_FOUND_STATUS_CODE = 404; const handleProviderServerErrors = (data: WebRequest.OnCompletedDetailsType) => { if (data?.type === 'xmlhttprequest' && runtime.getURL('').startsWith(data.initiator)) { - if (data.statusCode > UNAUTHORIZED_STATUS_CODE && data.statusCode < GATEWAY_TIMEOUT_STATUS_CODE) { + const statusCodeQualifiedAsFailure = + data.statusCode !== NOT_FOUND_STATUS_CODE && + data.statusCode > UNAUTHORIZED_STATUS_CODE && + data.statusCode < GATEWAY_TIMEOUT_STATUS_CODE; + if (statusCodeQualifiedAsFailure) { // A backend service request has failed, increment the failed requests count backendFailures$.next(backendFailures$.value + 1); } else {