'use client' import React from 'react' class ErrorBoundary extends React.Component { constructor(props) { super(props) this.state = { hasError: false, error: null, errorInfo: null } } static getDerivedStateFromError(error) { // Update state so the next render will show the fallback UI return { hasError: true } } componentDidCatch(error, errorInfo) { // Log detailed error information console.error('🚨 React Error Boundary caught an error:', { error, errorInfo, timestamp: new Date().toISOString(), componentStack: errorInfo.componentStack, errorStack: error.stack }) this.setState({ error: error, errorInfo: errorInfo }) } render() { if (this.state.hasError) { // You can render any custom fallback UI return (
Timestamp: {new Date().toISOString()}
Error: {this.state.error && this.state.error.toString()}
Stack Trace:
{this.state.errorInfo.componentStack}