diff --git a/client/build/asset-manifest.json b/client/build/asset-manifest.json index 231fe39..8f12f90 100644 --- a/client/build/asset-manifest.json +++ b/client/build/asset-manifest.json @@ -1,15 +1,15 @@ { "files": { "main.css": "/static/css/main.44e40ac2.css", - "main.js": "/static/js/main.49450b63.js", + "main.js": "/static/js/main.3a72e5e4.js", "static/js/453.d456ce70.chunk.js": "/static/js/453.d456ce70.chunk.js", "index.html": "/index.html", "main.44e40ac2.css.map": "/static/css/main.44e40ac2.css.map", - "main.49450b63.js.map": "/static/js/main.49450b63.js.map", + "main.3a72e5e4.js.map": "/static/js/main.3a72e5e4.js.map", "453.d456ce70.chunk.js.map": "/static/js/453.d456ce70.chunk.js.map" }, "entrypoints": [ "static/css/main.44e40ac2.css", - "static/js/main.49450b63.js" + "static/js/main.3a72e5e4.js" ] } \ No newline at end of file diff --git a/client/build/index.html b/client/build/index.html index 8b6ae45..e5cfbc7 100644 --- a/client/build/index.html +++ b/client/build/index.html @@ -1 +1 @@ -SkyWatch
\ No newline at end of file +SkyWatch
\ No newline at end of file diff --git a/client/src/ErrorBoundary.js b/client/src/ErrorBoundary.js new file mode 100644 index 0000000..01f760e --- /dev/null +++ b/client/src/ErrorBoundary.js @@ -0,0 +1,37 @@ +import React from 'react'; + +class ErrorBoundary extends React.Component { + constructor(props) { + super(props); + this.state = { hasError: false, error: null }; + } + + static getDerivedStateFromError(error) { + return { hasError: true, error }; + } + + componentDidCatch(error, info) { + // Log to console; could later POST to /api if needed + // eslint-disable-next-line no-console + console.error('App error:', error, info); + } + + render() { + if (this.state.hasError) { + return ( +
+

Something went wrong.

+

Please check the browser console for details.

+ {process.env.NODE_ENV === 'development' && this.state.error && ( +
+              {String(this.state.error)}
+            
+ )} +
+ ); + } + return this.props.children; + } +} + +export default ErrorBoundary; diff --git a/client/src/index.js b/client/src/index.js index d563c0f..266af4b 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -2,12 +2,15 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import './index.css'; import App from './App'; +import ErrorBoundary from './ErrorBoundary'; import reportWebVitals from './reportWebVitals'; const root = ReactDOM.createRoot(document.getElementById('root')); root.render( - + + + );