Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App router migration error boundary component #1121

Open
wants to merge 13 commits into
base: next-js-migration
Choose a base branch
from
Open
8 changes: 8 additions & 0 deletions app/error-route-test/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use client';

export default function Page() {
setTimeout(() => {
throw new Error('An Error');
}, 1000);
return <div>ERROR TESTING PAGE</div>;
}
3 changes: 2 additions & 1 deletion app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import GoogleTagManagerScript from '../components/head/GoogleTagManagerScript';
import ErrorBoundary from '../components/layout/ErrorBoundary';
import rootMetadata from './rootMetadata';
import RollbarScript from '../components/head/RollbarScript';

Expand All @@ -20,7 +21,7 @@ export default function RootLayout({
*/}
<GoogleTagManagerScript />
<RollbarScript />
{children}
<ErrorBoundary>{children}</ErrorBoundary>
</body>
</html>
);
Expand Down
2 changes: 2 additions & 0 deletions components/layout/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import { Alert, Snackbar } from '@mui/material';
import { Component, ErrorInfo, ReactNode } from 'react';

Expand Down
Loading