import { cn } from "@/lib/utils"; import { AlertTriangle, RotateCcw } from "lucide-react"; import { Component, ReactNode } from "react"; interface Props { children: ReactNode; } interface State { hasError: boolean; error: Error | null; } class ErrorBoundary extends Component { constructor(props: Props) { super(props); this.state = { hasError: false, error: null }; } static getDerivedStateFromError(error: Error): State { return { hasError: true, error }; } render() { if (this.state.hasError) { return (

An unexpected error occurred.

                {this.state.error?.stack}
              
); } return this.props.children; } } export default ErrorBoundary;