46 lines
1.2 KiB
TypeScript
46 lines
1.2 KiB
TypeScript
'use client'
|
|
|
|
import { useEffect } from 'react';
|
|
|
|
export default function GlobalError({
|
|
error,
|
|
reset,
|
|
}: {
|
|
error: Error & { digest?: string };
|
|
reset: () => void;
|
|
}) {
|
|
useEffect(() => {
|
|
// Log error to monitoring service (Sentry, etc.)
|
|
console.error('Global error:', error);
|
|
}, [error]);
|
|
|
|
return (
|
|
<html>
|
|
<body>
|
|
<div className="flex min-h-screen flex-col items-center justify-center p-4 bg-background">
|
|
<div className="text-center space-y-4 max-w-md">
|
|
<h2 className="text-2xl font-bold text-turo-primary">
|
|
Error Crítico
|
|
</h2>
|
|
<p className="text-muted-foreground">
|
|
{error.message || 'Ocurrió un error crítico en la aplicación'}
|
|
</p>
|
|
{error.digest && (
|
|
<p className="text-sm text-muted-foreground">
|
|
Error ID: {error.digest}
|
|
</p>
|
|
)}
|
|
<button
|
|
onClick={reset}
|
|
className="px-4 py-2 bg-turo-accent text-white rounded-lg hover:bg-turo-accent-hover transition-colors"
|
|
>
|
|
Reintentar
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|
|
|