forked from rocicorp/zero-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.tsx
More file actions
34 lines (31 loc) · 803 Bytes
/
error.tsx
File metadata and controls
34 lines (31 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
'use client'; // Error components must be Client Components
import {Button} from '@/components/ui/button';
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="min-h-[99vh] px-2 py-8 flex flex-col gap-3 items-start">
<div>
<h2 className="text-5xl font-bold">Oops!</h2>
<p className="text-muted-foreground">Something went wrong!</p>
</div>
<Button
onClick={
// Attempt to recover by trying to re-render the segment
() => reset()
}
>
Try again
</Button>
</div>
);
}