Files
ProjectE/apps/web/app/error.tsx
T

48 lines
1.3 KiB
TypeScript
Raw Normal View History

'use client';
import { useEffect } from 'react';
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from '@/components/ui/card';
export default function Error({
error,
reset,
}: {
error: Error & { digest?: string };
reset: () => void;
}) {
useEffect(() => {
console.error('Application error:', error);
}, [error]);
return (
<div className="flex min-h-[50vh] items-center justify-center p-6">
<Card className="max-w-md w-full">
<CardHeader>
<CardTitle>Something went wrong</CardTitle>
</CardHeader>
<CardContent>
<p className="text-muted-foreground">
An unexpected error occurred. Please try again or contact support
if the problem persists.
</p>
{error.digest && (
<p className="mt-2 text-xs text-muted-foreground font-mono">
Error ID: {error.digest}
</p>
)}
</CardContent>
<CardFooter className="flex gap-2">
<Button onClick={reset}>Try again</Button>
<Button
variant="outline"
onClick={() => (window.location.href = '/')}
>
Go home
</Button>
</CardFooter>
</Card>
</div>
);
}