fix: dont send errors in dev mode

This commit is contained in:
Torsten Dittmann
2024-06-26 12:41:56 +02:00
parent a57d752a4e
commit 3ccb67ce3f
2 changed files with 16 additions and 12 deletions

View File

@@ -1,8 +1,10 @@
import { SENTRY_DSN } from "$lib/constants";
import { handleErrorWithSentry, replayIntegration } from "@sentry/sveltekit";
import { dev } from '$app/environment';
import { SENTRY_DSN } from '$lib/constants';
import { handleErrorWithSentry, replayIntegration } from '@sentry/sveltekit';
import * as Sentry from '@sentry/sveltekit';
Sentry.init({
enabled: !dev,
dsn: SENTRY_DSN,
tracesSampleRate: 1.0,
@@ -15,7 +17,7 @@ Sentry.init({
replaysOnErrorSampleRate: 1.0,
// If you don't want to use Session Replay, just remove the line below:
integrations: [replayIntegration()],
integrations: [replayIntegration()]
});
// If you have a custom error handler, pass it to `handleErrorWithSentry`

View File

@@ -3,8 +3,10 @@ import type { Handle } from '@sveltejs/kit';
import redirects from './redirects.json';
import { sequence } from '@sveltejs/kit/hooks';
import { BANNER_KEY, SENTRY_DSN } from '$lib/constants';
import { dev } from '$app/environment';
Sentry.init({
enabled: !dev,
dsn: SENTRY_DSN,
tracesSampleRate: 1
})