31 lines
860 B
TypeScript
31 lines
860 B
TypeScript
'use client' // Error boundaries must be Client Components
|
|
|
|
import { useEffect } from 'react'
|
|
|
|
export default function Error({
|
|
error,
|
|
reset,
|
|
}: {
|
|
error: Error & { digest?: string }
|
|
reset: () => void
|
|
}) {
|
|
useEffect(() => {
|
|
// Log the error to an error reporting service
|
|
console.error(error)
|
|
}, [error])
|
|
|
|
return (
|
|
<div className="flex h-screen flex-col items-center justify-center bg-destructive/5 px-4 text-center">
|
|
<h1 className="text-3xl font-bold text-destructive">Something went wrong</h1>
|
|
<p className="mt-2 text-muted-foreground">
|
|
Please try refreshing the page or contact support if the problem persists.
|
|
</p>
|
|
<button
|
|
onClick={reset}
|
|
className="mt-6 rounded-lg bg-destructive px-4 py-2 text-white hover:bg-destructive/80"
|
|
>
|
|
Try Again
|
|
</button>
|
|
</div>
|
|
)
|
|
} |