webtools

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

global-error.tsx (670B)


      1 "use client";
      2 
      3 import * as Sentry from "@sentry/nextjs";
      4 import NextError from "next/error";
      5 import { useEffect } from "react";
      6 
      7 export default function GlobalError({
      8   error,
      9 }: {
     10   error: Error & { digest?: string };
     11 }) {
     12   useEffect(() => {
     13     Sentry.captureException(error);
     14   }, [error]);
     15 
     16   return (
     17     <html>
     18       <body>
     19         {/* `NextError` is the default Next.js error page component. Its type
     20         definition requires a `statusCode` prop. However, since the App Router
     21         does not expose status codes for errors, we simply pass 0 to render a
     22         generic error message. */}
     23         <NextError statusCode={0} />
     24       </body>
     25     </html>
     26   );
     27 }