fix: disable few sentry integrations

This commit is contained in:
EnixCoda 2020-03-04 00:30:55 +08:00
parent f3dbe9412f
commit c0fcf7b971
No known key found for this signature in database
GPG key ID: 0C1A07377913A1DD

View file

@ -15,6 +15,12 @@ const errorSet = new Set<string>([
'Failed to fetch', // network fail in Chrome
])
const disabledIntegrations: string[] = [
'TryCatch',
'Breadcrumbs',
'GlobalHandlers',
'CaptureConsole',
]
const sentryOptions: Sentry.BrowserOptions = {
dsn: `https://${PUBLIC_KEY}@sentry.io/${PROJECT_ID}`,
release: VERSION,
@ -22,7 +28,8 @@ const sentryOptions: Sentry.BrowserOptions = {
// Not safe to activate all integrations in non-Chrome environments where Gitako may not run in top context
// https://docs.sentry.io/platforms/javascript/#sdk-integrations
defaultIntegrations: IN_PRODUCTION_MODE ? undefined : false,
integrations: integrations => integrations.filter(({ name }) => name !== 'TryCatch'),
integrations: integrations =>
integrations.filter(({ name }) => !disabledIntegrations.includes(name)),
beforeSend(event) {
const message = event.exception?.values?.[0].value || event.message
if (message) {