error.tsx
1,144 bytes
| 1 | 'use client'; |
|---|---|
| 2 | |
| 3 | import { RotateCcw } from 'lucide-react'; |
| 4 | import { useEffect } from 'react'; |
| 5 | import { Button } from '@/components/ui/button'; |
| 6 | |
| 7 | export default function Error({ error, reset }: { error: Error & { digest?: string }; reset: () => void }) { |
| 8 | useEffect(() => { |
| 9 | console.error(error); |
| 10 | }, [error]); |
| 11 | |
| 12 | return ( |
| 13 | <div className="container flex min-h-[60vh] flex-col items-center justify-center gap-4 text-center"> |
| 14 | <p className="font-mono text-xs uppercase tracking-[0.22em] text-muted-foreground">error</p> |
| 15 | <h1 className="font-display text-3xl font-medium tracking-tight">Something went wrong.</h1> |
| 16 | <p className="max-w-md text-sm text-muted-foreground"> |
| 17 | An unexpected error occurred while loading this page. You can try again, or head back home. |
| 18 | </p> |
| 19 | <div className="mt-2 flex gap-3"> |
| 20 | <Button onClick={reset}> |
| 21 | <RotateCcw className="h-4 w-4" /> Try again |
| 22 | </Button> |
| 23 | <Button |
| 24 | variant="ghost" |
| 25 | onClick={() => { |
| 26 | window.location.href = '/'; |
| 27 | }} |
| 28 | > |
| 29 | Back home |
| 30 | </Button> |
| 31 | </div> |
| 32 | </div> |
| 33 | ); |
| 34 | } |
| 35 | |