Skip to content

Commit ebfb20d

Browse files
committed
Filter more errors from sentry
1 parent aa67e12 commit ebfb20d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

packages/common/src/utils/analytics.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export async function initializeSentry(dsn: string) {
9898
/.*\.codesandbox\.io/,
9999
/.*\.csb\.app/,
100100
],
101-
beforeSend: event => {
101+
beforeSend: (event, hint) => {
102102
if (
103103
event.stacktrace &&
104104
event.stacktrace.frames &&
@@ -113,6 +113,18 @@ export async function initializeSentry(dsn: string) {
113113
return undefined;
114114
}
115115

116+
const customError = ((hint && (hint.originalException as any)) || {})
117+
.error;
118+
119+
if (
120+
customError &&
121+
event.message &&
122+
event.message.startsWith('Non-Error exception captured')
123+
) {
124+
// This is an error coming from the sandbox, return with no error.
125+
return undefined;
126+
}
127+
116128
return event;
117129
},
118130
});

0 commit comments

Comments
 (0)