@@ -7,6 +7,9 @@ import 'animate.css/animate.min.css'
7
7
import { LayoutTransition } from '@/components/layout/layout-transition'
8
8
import Script from 'next/script'
9
9
import Footer from '../components/layout/footer'
10
+ // Import the components we created
11
+ import ErrorBoundary from '@/components/ErrorBoundary'
12
+ import GlobalErrorHandler from '@/components/GlobalErrorHandler'
10
13
11
14
export const metadata : Metadata = {
12
15
title : 'CodeBuilder, Inc. - Software Engineering Solutions.' ,
@@ -57,6 +60,11 @@ export default function RootLayout({
57
60
{ /* Other Meta Tags, Links, Etc... */ }
58
61
</ head >
59
62
< body className = { `${ Raleway . className } antialiased bg-white` } >
63
+ { /*
64
+ The GlobalErrorHandler is an invisible component that sets up
65
+ window-level event listeners for catching uncaught errors.
66
+ */ }
67
+ < GlobalErrorHandler />
60
68
< div className = "flex flex-col min-h-screen" >
61
69
< Header />
62
70
< LayoutTransition
@@ -68,7 +76,13 @@ export default function RootLayout({
68
76
{ /* Main content area */ }
69
77
< main className = "flex text-black bg-white" >
70
78
{ ' ' }
71
- < div className = "w-screen" > { children } </ div >
79
+ { /*
80
+ The ErrorBoundary wraps your entire application. It will catch
81
+ any rendering errors and display a fallback UI instead of crashing.
82
+ */ }
83
+ < ErrorBoundary >
84
+ < div className = "w-screen" > { children } </ div >
85
+ </ ErrorBoundary >
72
86
</ main >
73
87
{ /* Footer */ }
74
88
< Footer />
0 commit comments