Skip to content

Commit

Permalink
feat: add NextError global page
Browse files Browse the repository at this point in the history
  • Loading branch information
majkshkurti committed Sep 18, 2024
1 parent 42b77cc commit b7b362b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions apps/web/app/global-error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"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(() => {
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>
);
}

0 comments on commit b7b362b

Please sign in to comment.