import React from 'react' import { t } from '../i18n' import { reportReactError } from '../lib/diagnosticsCapture' import { Button } from './shared/Button' import { DoctorPanel } from './doctor/DoctorPanel' type Props = { children: React.ReactNode } type State = { hasError: boolean } export class ErrorBoundary extends React.Component { state: State = { hasError: false } static getDerivedStateFromError(): State { return { hasError: true } } componentDidCatch(error: unknown, errorInfo: React.ErrorInfo) { void reportReactError(error, errorInfo) } render() { if (this.state.hasError) { return } return this.props.children } } function ErrorBoundaryFallback() { return (
{t('errorBoundary.title')}
{t('errorBoundary.description')}
) }