Skip to content

Commit

Permalink
fix: prevent displaying poor connection pill for 404 responses (#1642)
Browse files Browse the repository at this point in the history
Co-authored-by: Szymon Masłowski <[email protected]>
  • Loading branch information
mchappell and szymonmaslowski committed Jan 14, 2025
1 parent c57d059 commit cdc1c12
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit cdc1c12

Please sign in to comment.