Configuración inicial del proyecto: estructura de directorios y dependencias mínimas instaladas
This commit is contained in:
45
app/global-error.tsx
Normal file
45
app/global-error.tsx
Normal file
@@ -0,0 +1,45 @@
|
||||
'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>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user