Fix Monaco hit testing filter and add debugging comments - Fixes COMPILER-EXPLORER-AXA

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 <noreply@anthropic.com>
This commit is contained in:
Matt Godbolt
2025-06-18 21:13:41 -05:00
co-authored by Claude
parent 1f047c38dc
commit b75d45bade
+9 -2
View File
@@ -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) {