Skip to content

Commit bbd8284

Browse files
silverwindclaude
andcommitted
Filter out browser extension errors from error handler
Explicitly detect and filter errors originating from browser extensions by checking for extension URL schemes (chrome-extension://, moz-extension://, safari-extension://, safari-web-extension://) in the error's filename and stack trace. This prevents unrelated extension errors from being shown to users. Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
1 parent dfd495f commit bbd8284

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

web_src/js/modules/errors.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ export function processWindowErrorEvent({error, reason, message, type, filename,
3838
if (runModeIsProd) return;
3939
}
4040

41+
// Filter out errors from browser extensions. Extension scripts use these URL schemes which
42+
// can appear in `filename` or the error's stack trace.
43+
const extensionPattern = /(chrome|moz|safari(-web)?)-extension:\/\//;
44+
if (extensionPattern.test(filename ?? '') || extensionPattern.test(err?.stack ?? '')) return;
45+
4146
// If the error stack trace does not include the base URL of our script assets, it likely came
4247
// from a browser extension or inline script. Do not show such errors in production.
4348
if (err instanceof Error && !err.stack?.includes(assetBaseUrl) && runModeIsProd) return;

0 commit comments

Comments
 (0)