/** * JARVIS — Error Boundary * Catches unhandled React errors and shows a recovery UI. * Wrap around top-level components in App.jsx. */ import React from 'react' import { RefreshCw, AlertTriangle } from 'lucide-react' export default class ErrorBoundary extends React.Component { constructor(props) { super(props) this.state = { hasError: false, error: null, info: null } } static getDerivedStateFromError(error) { return { hasError: true, error } } componentDidCatch(error, info) { console.error('[JARVIS ErrorBoundary]', error, info) this.setState({ info }) } render() { if (!this.state.hasError) return this.props.children return (
An unexpected error occurred. Your conversation history is safe — refresh to restart.