-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
166 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use client'; | ||
|
||
import * as Sentry from '@sentry/nextjs'; | ||
import NextError from 'next/error'; | ||
import { useEffect } from 'react'; | ||
|
||
export default function GlobalError({ error }: { error: Error & { digest?: string } }) { | ||
useEffect(() => { | ||
if (process.env.SENTRY_DSN) { | ||
Sentry.captureException(error); | ||
} | ||
}, [error]); | ||
|
||
return ( | ||
<html> | ||
<body> | ||
{/* `NextError` is the default Next.js error page component. Its type | ||
definition requires a `statusCode` prop. However, since the App Router | ||
does not expose status codes for errors, we simply pass 0 to render a | ||
generic error message. */} | ||
<NextError statusCode={0} /> | ||
</body> | ||
</html> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import * as Sentry from '@sentry/nextjs'; | ||
|
||
export function register() { | ||
const sentryDsn = process.env.SENTRY_DSN; | ||
if (sentryDsn) { | ||
Sentry.init({ | ||
dsn: sentryDsn, | ||
|
||
// Set tracesSampleRate to 1.0 to capture 100% | ||
// of transactions for tracing. | ||
// We recommend adjusting this value in production | ||
// Learn more at | ||
// https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate | ||
tracesSampleRate: 1.0, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.