import React, { Component, ErrorInfo, ReactNode } from 'react'; interface Props { children?: ReactNode; } interface State { hasError: boolean; error: Error | null; } class ErrorBoundary extends Component { public state: State = { hasError: false, error: null }; public static getDerivedStateFromError(error: Error): State { return { hasError: true, error }; } public componentDidCatch(error: Error, errorInfo: ErrorInfo) { console.error("Uncaught error:", error, errorInfo); } public render() { if (this.state.hasError) { return (

Software Crash Detected

{this.state.error?.name}: {this.state.error?.message}

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