27 lines
889 B
TypeScript
27 lines
889 B
TypeScript
|
import { handleErrorWithSentry, replayIntegration } from '@sentry/sveltekit';
|
||
|
import * as Sentry from '@sentry/sveltekit';
|
||
|
import { SENTRY_DSN } from '$env/dynamic/private';
|
||
|
import { NODE_ENV } from '$env/static/private';
|
||
|
|
||
|
Sentry.init({
|
||
|
dsn: SENTRY_DSN,
|
||
|
|
||
|
if (NODE_ENV === 'production') {
|
||
|
tracesSampleRate: 1.0,
|
||
|
} else {},
|
||
|
|
||
|
// This sets the sample rate to be 10%. You may want this to be 100% while
|
||
|
// in development and sample at a lower rate in production
|
||
|
replaysSessionSampleRate: 0.1,
|
||
|
|
||
|
// If the entire session is not sampled, use the below sample rate to sample
|
||
|
// sessions when an error occurs.
|
||
|
replaysOnErrorSampleRate: 1.0,
|
||
|
|
||
|
// If you don't want to use Session Replay, just remove the line below:
|
||
|
integrations: [replayIntegration()]
|
||
|
});
|
||
|
|
||
|
// If you have a custom error handler, pass it to `handleErrorWithSentry`
|
||
|
export const handleError = handleErrorWithSentry();
|