feat: feedback on crash
This commit is contained in:
parent
8117ade8c9
commit
142866805c
|
|
@ -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>
|
||||
);
|
||||
}
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue