feat: feedback on crash

This commit is contained in:
Nevo David 2025-07-31 13:37:43 +07:00
parent 8117ade8c9
commit 142866805c
3 changed files with 19 additions and 34 deletions

View File

@ -1,29 +0,0 @@
'use client';
import { useEffect } from 'react';
import * as Sentry from '@sentry/nextjs';
export default function GlobalError({ error }: { error: Error }) {
useEffect(() => {
const eventId = Sentry.captureException(error);
Sentry.showReportDialog({
eventId,
title: "Something broke!",
subtitle: "Please help us fix the issue by providing some details.",
labelComments: "What happened?",
labelName: "Your name",
labelEmail: "Your email",
labelSubmit: "Send Report",
lang: "en",
});
}, [error]);
return (
<html>
<body>
<h2>Something went wrong</h2>
<p>{error.message}</p>
</body>
</html>
);
}

View File

@ -10,11 +10,23 @@ export default function GlobalError({
error: Error & { digest?: string };
}) {
const { sentryDsn } = useVariables();
useEffect(() => {
if (!sentryDsn) {
return;
}
Sentry.captureException(error);
const eventId = Sentry.captureException(error);
Sentry.showReportDialog({
eventId,
title: 'Something broke!',
subtitle: 'Please help us fix the issue by providing some details.',
labelComments: 'What happened?',
labelName: 'Your name',
labelEmail: 'Your email',
labelSubmit: 'Send Report',
lang: 'en',
});
}, [error]);
return (
<html>

View File

@ -10,9 +10,11 @@ export const initializeSentryClient = (environment: string, dsn: string) =>
maskAllText: true,
maskAllInputs: true,
}),
Sentry.feedbackIntegration({
// Disable the injection of the default widget
autoInject: false,
}),
],
replaysSessionSampleRate:
environment === 'development' ? 1.0 : 0.1,
replaysOnErrorSampleRate:
environment === 'development' ? 1.0 : 0.1,
replaysSessionSampleRate: environment === 'development' ? 1.0 : 0.1,
replaysOnErrorSampleRate: environment === 'development' ? 1.0 : 0.1,
});