Download src/ErrorBoundary.js from snvskiit/resume: direct link, hf CLI and curl.
- Browser
- Download file 965 Bytes
-
https://huggingface.co/spaces/snvskiit/resume/resolve/main/src/ErrorBoundary.js
- Command line
-
hf download hf://spaces/snvskiit/resume/src/ErrorBoundary.js
-
curl -L -o ErrorBoundary.js https://huggingface.co/spaces/snvskiit/resume/resolve/main/src/ErrorBoundary.js
965 Bytes
| import React from 'react'; | |
| import './App.css'; | |
| class ErrorBoundary extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { hasError: false }; | |
| } | |
| static getDerivedStateFromError(error) { | |
| return { hasError: true }; | |
| } | |
| componentDidCatch(error, errorInfo) { | |
| console.error('ErrorBoundary caught an error:', error, errorInfo); | |
| } | |
| render() { | |
| if (this.state.hasError) { | |
| return ( | |
| <div className="error-container"> | |
| <h1 className="error-title">🚀 Oops!</h1> | |
| <p className="error-text"> | |
| Something went wrong with Satish's portfolio. Don't worry, this rarely happens! | |
| Please try refreshing the page or come back later. | |
| </p> | |
| <button className="retry-button" onClick={() => window.location.reload()}> | |
| Refresh Page | |
| </button> | |
| </div> | |
| ); | |
| } | |
| return this.props.children; | |
| } | |
| } | |
| export default ErrorBoundary; | |