diff --git a/src/components/ErrorBoundary.jsx b/src/components/ErrorBoundary.jsx index 775667e..3c1b656 100644 --- a/src/components/ErrorBoundary.jsx +++ b/src/components/ErrorBoundary.jsx @@ -3,7 +3,11 @@ import React from 'react'; class ErrorBoundary extends React.Component { constructor(props) { super(props); - this.state = { hasError: false }; + this.state = { + hasError: false, + error: null, + errorInfo: null + }; } static getDerivedStateFromError(error) { @@ -11,8 +15,14 @@ class ErrorBoundary extends React.Component { } componentDidCatch(error, errorInfo) { - console.error('Error:', error); + // Log error to console for debugging + console.error('ErrorBoundary caught an error:', error); console.error('Error Info:', errorInfo); + + this.setState({ + error: error, + errorInfo: errorInfo + }); } render() { @@ -25,12 +35,37 @@ class ErrorBoundary extends React.Component { display: 'flex', alignItems: 'center', justifyContent: 'center', + flexDirection: 'column', background: '#000000', - color: 'white' + color: 'white', + fontFamily: 'system-ui, -apple-system, sans-serif' }}>

Something went wrong

Please refresh the page or try again later.

+ {process.env.NODE_ENV === 'development' && ( +
+
+ + Error Details + +
+                    {this.state.error && this.state.error.toString()}
+                    {this.state.errorInfo && this.state.errorInfo.componentStack}
+                  
+
+
+ )}
);