fix(web): stop re-surfacing handled transient errors as exceptions#2194
Merged
Conversation
Expected transient failures were leaking into error tracking as fresh
"new issue" alerts even though the app already handles them:
- A network blip during the SuperTokens session check is console.error'd
in SessionProvider ("Failed to fetch").
- A retryable 502 PROVIDER_FAILURE (Google rejecting a write) is
console.error'd in handleError.
Both surfaced as captured exceptions only because capture_console_errors
turned deliberate, user-facing error handling into exception capture.
- Turn off capture_console_errors so handled errors don't double as
exceptions; unhandled errors/rejections are still captured.
- In handleError, treat a retryable backend-authored mutation error as an
expected transient failure: show the toast, skip console.error (also
replaces the raw "Request failed with status 502" toast with a friendly
message).
Generated-By: PostHog Code
Task-Id: 74de4a8f-2e3d-47de-bfce-1685feaf014b
tyler-dane
marked this pull request as ready for review
July 19, 2026 03:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three error-tracking issues were expected transient failures leaking in as noise from one staging user:
TypeError: Failed to fetch— a dropped connection during the SuperTokens session check,console.error'd inSessionProvider.checkIfSessionExists.PROVIDER_FAILURE(x2) — Google rejecting an event write; a retryable mutation errorconsole.error'd inhandleError.Both surfaced as captured exceptions only because PostHog's
capture_console_errorsturned deliberate, user-facing error handling (toast + localconsole.error) into exception capture. In this project every captured exception reports asgeneric/handled:false, and the retryable 502 — which React Query already catches, so it can only reach PostHog via aconsole.error— confirms that console-capture is the vector.Changes:
capture_console_errors: falseinCompassProvider. Handled errors the app deliberately logs no longer double as new issues; genuinely uncaught errors and promise rejections are still captured by the other two handlers.handleError, treat a retryable, backend-authored mutation error (502PROVIDER_FAILURE) as the expected transient failure it is: show the retry toast and skipconsole.error. This also replaces the raw"Request failed with status 502"toast with a friendly message.Why: every network blip or Google provider hiccup was spawning a fresh "new issue" alert that looked like a real regression but wasn't, costing ongoing triage. Staging-only, negligible volume, but it recurs on every such failure — this preserves error-tracking signal-to-noise.
Simplicity
Two small, targeted changes in the files the noise originates from — one config flag plus one guard clause. No new abstractions.
Automated validation
Not run (config + error-handling change with no user-facing flow to reproduce beyond the unit-tested branch).
Independent review
N/A.
Test plan
bun test --cwd packages/web src/common/utils/event/event.util.test.ts— 8 pass (incl. new "does not log a retryable, backend-authored mutation failure").bun test --cwd packages/web src/api/util/api.util.test.ts— 20 pass.bunx typescript@7.0.2 -p packages/web/tsconfig.app.json --noEmit— clean.bunx typescript@7.0.2 -p packages/web/tsconfig.test.json --noEmit— clean.biome checkon the three changed files — clean.Created with PostHog Code from this inbox report.