|
|
@@ -2,6 +2,7 @@
|
|
|
import getMeta from '../utils/meta'
|
|
|
import OError from '@overleaf/o-error'
|
|
|
import { debugConsole } from '@/utils/debugging'
|
|
|
+import type { ErrorEvent } from '@sentry/types/types/event'
|
|
|
|
|
|
const {
|
|
|
sentryAllowedOriginRegex,
|
|
|
@@ -12,6 +13,21 @@ const {
|
|
|
|
|
|
const reporterPromise = sentryDsn ? sentryReporter() : nullReporter()
|
|
|
|
|
|
+const isPropensityNetworkError = (err: ErrorEvent) => {
|
|
|
+ const errorBreadcrumbs = err.breadcrumbs?.filter(b => b.level === 'error')
|
|
|
+
|
|
|
+ if (!errorBreadcrumbs || errorBreadcrumbs.length !== 1) {
|
|
|
+ // don't ignore Propensity if there are more errors to report
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ return Boolean(
|
|
|
+ errorBreadcrumbs[0].data?.url.startsWith(
|
|
|
+ 'https://analytics.propensity.com/'
|
|
|
+ )
|
|
|
+ )
|
|
|
+}
|
|
|
+
|
|
|
function sentryReporter() {
|
|
|
return (
|
|
|
import(/* webpackMode: "eager" */ '@sentry/browser')
|
|
|
@@ -86,6 +102,10 @@ function sentryReporter() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if (isPropensityNetworkError(event)) {
|
|
|
+ return null
|
|
|
+ }
|
|
|
+
|
|
|
return event
|
|
|
},
|
|
|
})
|