2022-05-22 16:20:06 +02:00
|
|
|
import 'virtual:vite-plugin-sentry/sentry-config'
|
|
|
|
import type {App} from 'vue'
|
|
|
|
import type {Router} from 'vue-router'
|
2024-03-13 19:31:43 +01:00
|
|
|
import {AxiosError} from 'axios'
|
2021-10-31 13:37:57 +00:00
|
|
|
|
2023-06-18 15:01:49 +02:00
|
|
|
export default async function setupSentry(app: App, router: Router) {
|
2021-10-26 18:53:17 +00:00
|
|
|
const Sentry = await import('@sentry/vue')
|
|
|
|
const {Integrations} = await import('@sentry/tracing')
|
|
|
|
|
|
|
|
Sentry.init({
|
|
|
|
app,
|
2024-02-09 14:24:29 +01:00
|
|
|
dsn: window.SENTRY_DSN ?? '',
|
2022-05-22 16:20:06 +02:00
|
|
|
release: import.meta.env.VITE_PLUGIN_SENTRY_CONFIG.release,
|
|
|
|
dist: import.meta.env.VITE_PLUGIN_SENTRY_CONFIG.dist,
|
2021-10-26 18:53:17 +00:00
|
|
|
integrations: [
|
|
|
|
new Integrations.BrowserTracing({
|
|
|
|
routingInstrumentation: Sentry.vueRouterInstrumentation(router),
|
|
|
|
tracingOrigins: ['localhost', /^\//],
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
tracesSampleRate: 1.0,
|
2024-03-13 19:31:43 +01:00
|
|
|
beforeSend(event, hint) {
|
|
|
|
|
|
|
|
if ((typeof hint.originalException?.code !== 'undefined' &&
|
|
|
|
typeof hint.originalException?.message !== 'undefined')
|
|
|
|
|| hint.originalException instanceof AxiosError) {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
|
|
|
return event
|
|
|
|
},
|
2021-10-26 18:53:17 +00:00
|
|
|
})
|
|
|
|
}
|