mirror of
https://github.com/bitbaum/botsmann.git
synced 2026-12-04 08:58:06 +01:00
Security fixes: - Add npm override for fast-xml-parser@^5.3.4 to fix RangeError DoS - Update @aws-sdk/client-ses to 3.980.0 - Reduces vulnerabilities from 25 to 8 (fixed 17 high severity) Code improvements (prep for future Next.js 15): - Replace <a> tags with <Link> components for internal navigation - Create ConsultationFormLoader client wrapper for dynamic imports - Use direct Analytics import instead of dynamic with ssr:false - Add eslint-disable for global-error.tsx (intentional <a> usage) Remaining vulnerabilities (require breaking changes): - 7 moderate: eslint circular reference stack overflow - 1 high: Next.js DoS (specific conditions, low practical risk) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
77 lines
2.4 KiB
TypeScript
77 lines
2.4 KiB
TypeScript
'use client';
|
|
|
|
import { useEffect } from 'react';
|
|
import Link from 'next/link';
|
|
|
|
interface ErrorProps {
|
|
error: Error & { digest?: string };
|
|
reset: () => void;
|
|
}
|
|
|
|
/**
|
|
* Error Boundary for App Router segments
|
|
*
|
|
* Catches errors in child components and displays a fallback UI.
|
|
* Users can attempt to recover by re-rendering the segment.
|
|
*/
|
|
export default function Error({ error, reset }: ErrorProps) {
|
|
useEffect(() => {
|
|
// Log error to console in development
|
|
if (process.env.NODE_ENV === 'development') {
|
|
console.error('Error caught by boundary:', error);
|
|
}
|
|
// In production, you could send to an error tracking service here
|
|
}, [error]);
|
|
|
|
return (
|
|
<div className="min-h-[60vh] flex items-center justify-center px-4">
|
|
<div className="text-center max-w-md">
|
|
<div className="mb-6">
|
|
<div className="w-16 h-16 mx-auto rounded-full bg-red-100 flex items-center justify-center">
|
|
<svg
|
|
className="w-8 h-8 text-red-600"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
viewBox="0 0 24 24"
|
|
>
|
|
<path
|
|
strokeLinecap="round"
|
|
strokeLinejoin="round"
|
|
strokeWidth={2}
|
|
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
|
|
/>
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
|
|
<h2 className="text-2xl font-bold text-gray-900 mb-2">Something went wrong</h2>
|
|
|
|
<p className="text-gray-600 mb-6">
|
|
An unexpected error occurred. Don't worry, your data is safe.
|
|
</p>
|
|
|
|
{process.env.NODE_ENV === 'development' && error.message && (
|
|
<div className="mb-6 p-4 bg-gray-100 rounded-lg text-left">
|
|
<p className="text-sm font-mono text-gray-700 break-all">{error.message}</p>
|
|
</div>
|
|
)}
|
|
|
|
<div className="flex flex-col sm:flex-row gap-3 justify-center">
|
|
<button
|
|
onClick={reset}
|
|
className="px-6 py-3 bg-primary text-white font-medium rounded-lg hover:bg-primary/90 transition-colors"
|
|
>
|
|
Try again
|
|
</button>
|
|
<Link
|
|
href="/"
|
|
className="px-6 py-3 bg-gray-100 text-gray-700 font-medium rounded-lg hover:bg-gray-200 transition-colors"
|
|
>
|
|
Go home
|
|
</Link>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|