From 5ba906cf84c6db9a42f5d1d3bd751e3ad861cc7b Mon Sep 17 00:00:00 2001 From: Chneemann Date: Mon, 24 Aug 2026 19:29:49 +0200 Subject: [PATCH] feat(ui): add error boundary fallback page with retry and recovery actions --- app/(app)/error.tsx | 77 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 app/(app)/error.tsx diff --git a/app/(app)/error.tsx b/app/(app)/error.tsx new file mode 100644 index 0000000..4992aa1 --- /dev/null +++ b/app/(app)/error.tsx @@ -0,0 +1,77 @@ +/** + * @file app/(app)/error.tsx + * @description Client-side error boundary component that renders an error fallback UI with recovery and navigation actions. + */ + +"use client"; + +import Link from "next/link"; +import { AlertTriangle, RefreshCw, ArrowLeft } from "lucide-react"; + +/** + * Properties for the ErrorBoundary component. + * + * @interface ErrorBoundaryProps + * @property {Error & { digest?: string }} error - The error object caught by the Next.js error boundary. + * @property {() => void} reset - Function to reset the error boundary and attempt to re-render the segment. + */ +interface ErrorBoundaryProps { + error: Error & { digest?: string }; + reset: () => void; +} + +/** + * Renders an error boundary fallback UI displaying error details, a retry button, and navigation back to the summary page. + * + * @param {ErrorBoundaryProps} props - The component props. + * @returns {JSX.Element} The rendered error boundary fallback component. + */ +export default function ErrorBoundary({ error, reset }: ErrorBoundaryProps) { + return ( +
+
+ {/* Icon Badge */} +
+ +
+ + {/* Text Content */} +
+

+ Something went wrong! +

+

+ An unexpected error occurred while processing your request. You can + try reloading this section or head back to your summary. +

+ {error?.message && ( +
+ {error.message} +
+ )} +
+ + {/* Action Buttons */} +
+ {/* Try Again Button */} + + + {/* Back to Summary Link */} + + + Back to Summary + +
+
+
+ ); +}