Merge pull request #9112 from overleaf/ii-sentry-extension-errors

[web] Prevent logging of extension errors to Sentry

GitOrigin-RevId: 42bc4ec045585586d2a6fe695cd55ef98adf2bf9
This commit is contained in:
ilkin-overleaf 2022-08-05 12:03:24 +03:00 committed by Copybot
parent 678148d1b9
commit 4dc9f71946

View file

@ -40,6 +40,12 @@ function sentryReporter() {
/Non-Error promise rejection captured with value: Object Not Found Matching Id/,
],
denyUrls: [
// Chrome extensions
/extensions\//i,
/^chrome:\/\//i,
],
beforeSend(event) {
// Limit number of events sent to Sentry to 100 events "per page load",
// (i.e. the cap will be reset if the page is reloaded). This prevent
@ -47,9 +53,16 @@ function sentryReporter() {
eventCount++
if (eventCount > 100) {
return null // Block the event from sending
} else {
return event
}
// Do not send events related to third party code (extensions)
if (
event.extra?.arguments?.[0]?.type === 'UNSTABLE_editor:extensions'
) {
return null // Block the event from sending
}
return event
},
})