From 117079bbda9a6b83f6d49061dd2a16ac167cc8e1 Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 13 Mar 2024 19:31:43 +0100 Subject: [PATCH] fix(sentry): do not send api errors to sentry --- frontend/src/sentry.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/frontend/src/sentry.ts b/frontend/src/sentry.ts index d48769dbf..32362f80e 100644 --- a/frontend/src/sentry.ts +++ b/frontend/src/sentry.ts @@ -1,6 +1,7 @@ import 'virtual:vite-plugin-sentry/sentry-config' import type {App} from 'vue' import type {Router} from 'vue-router' +import {AxiosError} from 'axios' export default async function setupSentry(app: App, router: Router) { const Sentry = await import('@sentry/vue') @@ -18,5 +19,15 @@ export default async function setupSentry(app: App, router: Router) { }), ], tracesSampleRate: 1.0, + beforeSend(event, hint) { + + if ((typeof hint.originalException?.code !== 'undefined' && + typeof hint.originalException?.message !== 'undefined') + || hint.originalException instanceof AxiosError) { + return null + } + + return event + }, }) }