Skip to content

feat(telemetry): report uncaught errors - #5

Merged
PhilippTheServer merged 1 commit into
mainfrom
pl/error-reporting
Aug 26, 2026
Merged

PhilippTheServer merged 1 commit into
mainfrom
pl/error-reporting

Conversation

@PhilippTheServer

Copy link
Copy Markdown
Contributor

Closes #4 · consumes OpenTaberna/fastapi#51

An error that breaks checkout was visible only in the console of the person it happened to.
A global ErrorHandler now reports uncaught errors to the API — off by default, like the
analytics port.

A render loop must not become a request loop

The failure mode being reported on is a component throwing during render, which calls the
handler as fast as the browser can loop. So:

  • an identical error is reported at most 3 times per session
  • a hard 50-per-session ceiling regardless of how many distinct errors
  • reports are batched, and a failing endpoint is swallowed

A reporter that turns a render loop into a request loop takes a broken page and makes it a
broken page plus a hammered API.

Anything can be thrown in JavaScript

And frameworks do. Nothing assumes an Error shape — strings, bare objects and null all
produce a usable report rather than an exception raised inside the error handler, which
would be a genuinely bad place to throw.

It still logs to the console

Swallowing that would remove what a developer looks at first, in exchange for a report they
cannot see locally. And if the reporter itself throws, that is caught, so it can never mask
the original error.

Verification

$ npx ng test --watch=false
 Test Files  2 passed (2)
      Tests  23 passed (23)

$ npx ng build
Initial total | 330.11 kB | 89.60 kB

Twelve new tests, each pinning a way this could make things worse: 500 identical throws
produce 3 reports; 100 distinct errors stop at the ceiling; a thrown string, a bare object
and null are all handled; the query string is stripped from the reported path; a failing
endpoint does not throw; the console still receives the error; and a reporter that throws
does not mask it.

An error that breaks checkout was visible only in the console of the person it
happened to, which means nobody who could fix it ever saw it.

Adds a global ErrorHandler reporting uncaught errors to the API, off by default
like the analytics port.

The failure mode being reported on is a component throwing inside a render loop,
which calls the handler as fast as the browser can loop. So an identical error
is reported at most three times per session, there is a hard per-session
ceiling, reports are batched, and a failing endpoint is swallowed. A reporter
that turns a render loop into a request loop takes a broken page and makes it a
broken page plus a hammered API.

Anything can be thrown in JavaScript and frameworks do, so nothing assumes an
Error shape: strings, bare objects and null all produce a usable report rather
than an exception inside the error handler.

The handler still logs to the console. Swallowing that would remove what a
developer looks at first in exchange for a report they cannot see locally. A
reporter that throws is caught, so it can never mask the original error.

Closes #4

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YY1ekLLeFLkAU2kvdQ8Ey4
@PhilippTheServer
PhilippTheServer merged commit fc44e69 into main Aug 26, 2026
1 check passed
@PhilippTheServer
PhilippTheServer deleted the pl/error-reporting branch August 26, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uncaught errors go to the console and nowhere else

1 participant