Skip to content

Commit 91cb876

Browse files
committed
fix: filter Monaco cancellation errors in Sentry beforeSend
1 parent ccc5d7d commit 91cb876

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

frontend/src/main.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,24 @@ declare global {
3434
if (window.__CONFIG__?.SENTRY_DSN_FRONTEND) {
3535
Sentry.init({
3636
dsn: window.__CONFIG__.SENTRY_DSN_FRONTEND,
37+
beforeSend(event, hint) {
38+
const error = hint.originalException;
39+
// Filter out Monaco editor cancellation errors (expected during navigation/disposal)
40+
if (
41+
error instanceof Error &&
42+
(error.name === "Canceled" || error.message === "Canceled")
43+
) {
44+
return null;
45+
}
46+
// Filter out Monaco worker load errors (already handled locally)
47+
if (
48+
error instanceof ErrorEvent ||
49+
(error instanceof Event && error.type === "error")
50+
) {
51+
return null;
52+
}
53+
return event;
54+
},
3755
});
3856
}
3957

0 commit comments

Comments
 (0)