Skip to content

Commit

Permalink
simplified sentry error filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
mariotaku committed Apr 1, 2024
1 parent 2cd1295 commit b0b7bf1
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,12 @@ Sentry.init({
return null;
},
beforeSend: (event, hint) => {
if (!event.exception) {
return null;
}
const unhandled = event.exception.values?.filter(e => {
if (e.mechanism?.handled) {
return false;
}
const originalException: any = hint.originalException;
if (originalException && originalException['reason']) {
return originalException['unhandled'] === true;
const originalException: any = hint.originalException;
if (originalException && originalException['reason']) {
if (originalException['unhandled'] !== true) {
return null;
}
return true;
});
if (!unhandled?.length) {
return null;
}
event.exception.values = unhandled;
return event;
},
// Set tracesSampleRate to 1.0 to capture 100%
Expand Down

0 comments on commit b0b7bf1

Please sign in to comment.