"use client"; import { Component, type ReactNode } from "react"; import Link from "next/link"; interface ErrorBoundaryProps { children: ReactNode; } interface ErrorBoundaryState { hasError: boolean; error?: Error; } /** * Error boundary component for graceful error handling * Uses PDA-friendly language and calm visual design */ export class ErrorBoundary extends Component { constructor(props: ErrorBoundaryProps) { super(props); this.state = { hasError: false }; } static getDerivedStateFromError(error: Error): ErrorBoundaryState { return { hasError: true, error, }; } componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void { // Log to console for debugging (could also send to error tracking service) console.error("Component error:", error, errorInfo); } handleReload = (): void => { window.location.reload(); }; render(): React.ReactNode { if (this.state.hasError) { return (
{/* Icon - calm blue instead of alarming red */}
{/* Message - PDA-friendly, no harsh language */}

Something unexpected happened

The page ran into an issue while loading. You can try refreshing or head back home to continue.

{/* Actions */}
Go home
{/* Technical details in dev mode */} {process.env.NODE_ENV === "development" && this.state.error && (
Technical details
                  {this.state.error.message}
                  {"\n\n"}
                  {this.state.error.stack}
                
)}
); } return this.props.children; } }