[WEB-1669] chore: enable sign out and sentry on exception error page. (#4884)

* [WEB-1669] chore: enable sign out and sentry on exception error page.

* fix: global error handling

---------

Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
This commit is contained in:
Prateek Shourya 2024-06-20 16:50:05 +05:30 committed by GitHub
parent c36c98476c
commit 280a69bd3c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 48 additions and 36 deletions

23
web/app/global-error.tsx Normal file
View file

@ -0,0 +1,23 @@
"use client";
import { useEffect } from "react";
import * as Sentry from "@sentry/nextjs";
import NextError from "next/error";
export default function GlobalError({ error }: { error: Error & { digest?: string } }) {
useEffect(() => {
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>
);
}