import { Component, type ReactNode } from "react"; interface Props { children: ReactNode; } interface State { error: Error | null; } // ponytail: a tiny class component. New dep (`react-error-boundary`) is 4KB // for a feature that's 20 lines. Roll it by hand. export class ErrorBoundary extends Component { state: State = { error: null }; static getDerivedStateFromError(error: Error): State { return { error }; } componentDidCatch(error: Error) { console.error("Uncaught error in DM-Pal:", error); } render() { if (this.state.error) { return (

Something went wrong

            {this.state.error.message}
          
); } return this.props.children; } }