Skip to content

Commit 09aaacb

Browse files
committed
add general error boundary
1 parent c339e6c commit 09aaacb

File tree

1 file changed

+12
-1
lines changed
  • exercises/99.final/01.solution.final/src

1 file changed

+12
-1
lines changed

exercises/99.final/01.solution.final/src/routes.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { SignupRoute } from './routes/signup.tsx'
1818

1919
export const router = createBrowserRouter(
2020
createRoutesFromElements(
21-
<Route>
21+
<Route errorElement={<UnknownErrorBoundary />}>
2222
<Route element={<AppLayout />}>
2323
<Route element={<MarketingLayout />}>
2424
<Route index element={<HomepageRoute />} />
@@ -37,3 +37,14 @@ export const router = createBrowserRouter(
3737
</Route>,
3838
),
3939
)
40+
41+
function UnknownErrorBoundary() {
42+
return (
43+
<div className="bg-danger-background text-danger-foreground mt-20 flex h-full flex-col items-center justify-center px-8 py-12">
44+
<h1 className="text-2xl font-bold">Unknown error</h1>
45+
<p className="text-danger-foreground/80 text-sm">
46+
An unknown error occurred. Please try again later.
47+
</p>
48+
</div>
49+
)
50+
}

0 commit comments

Comments
 (0)