Files
klz-cables.com/app/[locale]/error.tsx
Marc Mintel 33d2d67774
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 12s
Build & Deploy / 🧪 QA (push) Successful in 1m58s
Build & Deploy / 🏗️ Build (push) Successful in 5m44s
Build & Deploy / 🚀 Deploy (push) Successful in 27s
Build & Deploy / 🧪 Smoke Test (push) Successful in 48s
Build & Deploy / 🛡️ Quality Gates (push) Successful in 1m39s
Build & Deploy / ⚡ Lighthouse (push) Successful in 5m39s
Build & Deploy / ♿ WCAG (push) Successful in 5m35s
Build & Deploy / 🔔 Notify (push) Successful in 2s
feat: Improve error handling, refine i18n title fallbacks for product pages, update Next.js type paths, and add an image loader test file.
2026-02-22 18:30:44 +01:00

68 lines
2.2 KiB
TypeScript

'use client';
import { useEffect } from 'react';
import { useTranslations } from 'next-intl';
import { getAppServices } from '@/lib/services/create-services';
import { Container, Button, Heading } from '@/components/ui';
import Scribble from '@/components/Scribble';
export default function Error({
error,
reset,
}: {
error: Error & { digest?: string };
reset: () => void;
}) {
const t = useTranslations('Error');
useEffect(() => {
// Treat "Failed to find Server Action" as a deployment sync issue and reload
if (error?.message?.includes('Failed to find Server Action')) {
window.location.reload();
return;
}
const services = getAppServices();
services.errors.captureException(error);
services.logger.error('Application error caught by boundary', {
message: error?.message || 'Unknown error',
stack: error?.stack,
digest: error?.digest,
});
}, [error]);
return (
<Container className="relative py-24 flex flex-col items-center justify-center text-center min-h-[70vh] overflow-hidden">
{/* Industrial Background Element */}
<div className="absolute inset-0 -z-10 opacity-[0.03] pointer-events-none flex items-center justify-center">
<span className="text-[20rem] font-bold select-none">500</span>
</div>
<div className="relative mb-8">
<Heading level={1} className="text-6xl md:text-8xl font-bold mb-2 text-saturated">
500
</Heading>
<Scribble variant="underline" className="w-full h-6 -bottom-2 left-0 text-saturated/40" />
</div>
<Heading level={2} className="text-2xl md:text-3xl font-bold mb-4">
{t('title')}
</Heading>
<p className="text-white/60 mb-10 max-w-md text-lg">{t('description')}</p>
<div className="flex flex-col sm:flex-row gap-4">
<Button onClick={() => reset()} variant="saturated" size="lg">
{t('tryAgain')}
</Button>
<Button href="/" variant="outline" size="lg">
{t('goHome')}
</Button>
</div>
{/* Decorative Industrial Line */}
<div className="absolute top-0 left-1/2 -translate-x-1/2 w-px h-24 bg-gradient-to-b from-saturated/50 to-transparent" />
</Container>
);
}