My-Weekly-ToDo-List/src/app/global-error.tsx

29 lines
888 B
TypeScript

'use client';
export default function GlobalError({
error,
reset,
}: {
error: Error & { digest?: string };
reset: () => void;
}) {
return (
<html>
<body>
<div className="flex h-screen w-full flex-col items-center justify-center bg-white text-black">
<h2 className="mb-4 text-2xl font-bold">Something went wrong!</h2>
<p className="mb-4 text-gray-600">
{error.message || 'A critical error occurred'}
</p>
<button
className="rounded bg-blue-500 px-6 py-3 text-white transition-colors hover:bg-blue-600"
onClick={() => reset()}
>
Try again
</button>
</div>
</body>
</html>
);
}