Skip to content

Commit

Permalink
error boundaries
Browse files Browse the repository at this point in the history
  • Loading branch information
wheattoast11 committed Nov 30, 2024
1 parent 2466bda commit 0806851
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/components/ErrorBoundary.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,27 @@ class ErrorBoundary extends React.Component {
}

static getDerivedStateFromError(error) {
if (error && !error.message?.includes('Failed to load resource')) {
console.log('ErrorBoundary getDerivedStateFromError:', error);
console.log('Error type:', error?.constructor?.name);
console.log('Error message:', error?.message);

if (error &&
!error.message?.includes('Failed to load resource') &&
!error.message?.includes('Loading chunk') &&
!error.message?.includes('Loading CSS chunk')) {
return { hasError: true };
}
return null;
}

componentDidCatch(error, errorInfo) {
if (error && !error.message?.includes('Failed to load resource')) {
console.error('ErrorBoundary caught an error:', error);
console.error('Error Info:', errorInfo);

console.log('ErrorBoundary componentDidCatch:', error);
console.log('Component stack:', errorInfo?.componentStack);

if (error &&
!error.message?.includes('Failed to load resource') &&
!error.message?.includes('Loading chunk') &&
!error.message?.includes('Loading CSS chunk')) {
this.setState({
error: error,
errorInfo: errorInfo
Expand Down

0 comments on commit 0806851

Please sign in to comment.