File
Blob: src/client/lib/benign-browser-errors.ts
| 1 | // Known-benign window errors that should be suppressed before they reach the |
| 2 | // client error reporter. Keep this list short and well-justified — every new |
| 3 | // entry is a place where we're choosing not to see a real regression. |
| 4 | |
| 5 | // Fired when a ResizeObserver callback schedules another layout pass the |
| 6 | // browser couldn't deliver in the same frame. It's a spec-level notice, not a |
| 7 | // fault, and floating-ui's autoUpdate (used by our popovers) triggers it on |
| 8 | // mount. See https://github.com/floating-ui/floating-ui/issues/1740. |
| 9 | const RESIZE_OBSERVER_BENIGN = /ResizeObserver loop (completed with undelivered notifications|limit exceeded)/; |
| 10 | |
| 11 | export function isBenignBrowserError(event: ErrorEvent): boolean { |
| 12 | if (typeof event.message === "string" && RESIZE_OBSERVER_BENIGN.test(event.message)) return true; |
| 13 | const err = event.error; |
| 14 | if (err && typeof err === "object" && "message" in err && typeof err.message === "string") { |
| 15 | return RESIZE_OBSERVER_BENIGN.test(err.message); |
| 16 | } |
| 17 | return false; |
| 18 | } |