import React from 'react'; import { Box, Typography, Button } from '@mui/material'; import ErrorIcon from '@mui/icons-material/Error'; class ErrorBoundary extends React.Component { constructor(props) { super(props); this.state = { hasError: false, error: null }; } static getDerivedStateFromError(error) { return { hasError: true, error }; } componentDidCatch(error, errorInfo) { console.error('ErrorBoundary caught an error:', error, errorInfo); } render() { if (this.state.hasError) { return ( Something went wrong {this.state.error && this.state.error.toString()} ); } return this.props.children; } } export default ErrorBoundary;