34 lines
888 B
TypeScript
34 lines
888 B
TypeScript
'use client';
|
|
|
|
import { useEffect } from 'react';
|
|
|
|
export default function GlobalError({
|
|
error,
|
|
reset,
|
|
}: {
|
|
error: Error & { digest?: string };
|
|
reset: () => void;
|
|
}) {
|
|
useEffect(() => {
|
|
// TODO: send to telemetry once wired
|
|
}, [error]);
|
|
|
|
return (
|
|
<div className="flex min-h-screen items-center justify-center p-4">
|
|
<div className="mx-auto max-w-md text-center">
|
|
<div className="mb-4 text-5xl">⚠</div>
|
|
<h2 className="mb-2 text-xl font-semibold">Something went wrong</h2>
|
|
<p className="mb-6 text-sm text-muted-foreground">
|
|
{error.message || 'An unexpected error occurred.'}
|
|
</p>
|
|
<button
|
|
onClick={reset}
|
|
className="rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90"
|
|
>
|
|
Try again
|
|
</button>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|