- Lower tracesSampleRate from 1.0 to 0.1 in both hooks (errors still captured at 100%; trace volume reduced for self-hosted GlitchTip on shared VPS) - Add comment explaining VITE_SENTRY_DSN is a write-only ingest key, safe in client bundle — prevents accidental rotation as if it were a password - Restore HTTP status code prominence: text-4xl font-bold (was text-xs text-ink-3) - Add min-w-[44px] to copy button for WCAG 2.2 minimum touch target Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
17 lines
595 B
TypeScript
17 lines
595 B
TypeScript
import * as Sentry from '@sentry/sveltekit';
|
|
|
|
// VITE_SENTRY_DSN is a write-only ingest key — it can POST events to GlitchTip
|
|
// but cannot read them. Safe to include in the client bundle per Sentry security model.
|
|
Sentry.init({
|
|
dsn: import.meta.env.VITE_SENTRY_DSN,
|
|
environment: import.meta.env.MODE,
|
|
tracesSampleRate: 0.1,
|
|
sendDefaultPii: false,
|
|
enabled: !!import.meta.env.VITE_SENTRY_DSN
|
|
});
|
|
|
|
export const handleError = Sentry.handleErrorWithSentry(() => {
|
|
const errorId = Sentry.lastEventId() ?? crypto.randomUUID();
|
|
return { message: 'An unexpected error occurred', errorId };
|
|
});
|