'use client';
import { useEffect } from 'react';
/**
* Last resort for errors in the root layout. It REPLACES the layout: own
* /
, no providers, so texts are hard-coded and styles inline.
* Errors outside the React tree never reach it; they get Next's static 500.
* Do not add pages/500.tsx: next to app/ it makes usePathname, useSearchParams
* and useParams nullable project-wide.
*/
const PRODUCT_NAME = '{{PROJECT_TITLE}}';
export default function GlobalError({
error,
retry,
}: {
error: Error & { digest?: string };
retry: () => void;
}) {
useEffect(() => {
// Report it: swap in your error tracker here, e.g. Sentry.captureException(error).
console.error(error);
}, [error]);
return (
{PRODUCT_NAME}
Something went wrong
The page could not be loaded. Trying again usually helps.
{/* A hard navigation on purpose: a full page load rebuilds the broken state. */}
{/* eslint-disable-next-line @next/next/no-html-link-for-pages -- see the line above */}
Back to the home page