From b75d45bade97f8aec79dab3db626b4047a208a03 Mon Sep 17 00:00:00 2001 From: Matt Godbolt Date: Wed, 18 Jun 2025 21:13:41 -0500 Subject: [PATCH] Fix Monaco hit testing filter and add debugging comments - Fixes COMPILER-EXPLORER-AXA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The hit testing filter was checking frames[0].function for '_doHitTestWithCaretPositionFromPoint' but due to Sentry wrapping, frames[0] is 'sentryWrapped' and the actual function name appears in the error message string instead. Also added comprehensive comments explaining common Sentry filtering gotchas: - Error messages vs UI display format differences - Frame structure with Sentry wrappers - How to debug filters using actual JSON from Sentry UI 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- static/sentry.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/static/sentry.ts b/static/sentry.ts index 561cbf609..09e273903 100644 --- a/static/sentry.ts +++ b/static/sentry.ts @@ -73,20 +73,27 @@ export function SetupSentry() { ], beforeSend(event, hint) { // Filter Monaco Editor errors + // NOTE: When debugging filters, check the actual JSON structure from Sentry UI + // - event.exception.values[0].value contains the error message + // - event.exception.values[0].type contains the error type + // - Sentry UI shows "type: value" but actual JSON has separate fields + // - frames[0] is often Sentry's wrapper, not the original error source if (event.exception?.values?.[0]?.stacktrace?.frames) { const frames = event.exception.values[0].stacktrace.frames; - const topFrame = frames[0]; // Filter hit testing errors // See: https://github.com/microsoft/monaco-editor/issues/4527 - if (topFrame?.function === '_doHitTestWithCaretPositionFromPoint') { + // NOTE: Function name appears in error message, not as frame.function due to Sentry wrapping + if (event.exception.values[0].value?.includes('_doHitTestWithCaretPositionFromPoint')) { return null; // Don't send to Sentry } // Filter clipboard cancellation errors + // NOTE: Frame filename matching works as expected for file path filtering const hasClipboardFrame = frames.some(frame => frame.filename?.includes('monaco-editor/esm/vs/platform/clipboard/browser/clipboardService.js'), ); + // NOTE: Error value is just "Canceled", not "Canceled: Canceled" (UI combines type + value) const isCancellationError = event.exception.values[0].value === 'Canceled'; if (hasClipboardFrame && isCancellationError) {