import { Button } from '@/components/ui/button' import { RotateCw } from 'lucide-react' import React, { Component, ReactNode } from 'react' interface ErrorBoundaryProps { children: ReactNode } interface ErrorBoundaryState { hasError: boolean error?: Error } export class ErrorBoundary extends Component { constructor(props: ErrorBoundaryProps) { super(props) this.state = { hasError: false } } static getDerivedStateFromError(error: Error) { return { hasError: true, error } } componentDidCatch(error: Error, errorInfo: React.ErrorInfo) { console.error('ErrorBoundary caught an error:', error, errorInfo) } render() { if (this.state.hasError) { return (

Oops, something went wrong.

Sorry for the inconvenience. If you don't mind helping, you can{' '} submit an issue on GitHub {' '} with the error details, or{' '} mention me . Thank you for your support!

{this.state.error?.message && ( <>
                Error: {this.state.error.message}
              
)}
) } return this.props.children } }