File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
exercises/99.final/01.solution.final/src Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change 2
2
createBrowserRouter ,
3
3
createRoutesFromElements ,
4
4
Route ,
5
+ useRouteError ,
5
6
} from 'react-router'
6
7
import { NotFoundRoute } from './routes/404.tsx'
7
8
import { AppLayout } from './routes/app/layout.tsx'
@@ -39,12 +40,17 @@ export const router = createBrowserRouter(
39
40
)
40
41
41
42
function UnknownErrorBoundary ( ) {
43
+ const error = useRouteError ( )
44
+
42
45
return (
43
46
< div className = "bg-danger-background text-danger-foreground mt-20 flex h-full flex-col items-center justify-center px-8 py-12" >
44
47
< h1 className = "text-2xl font-bold" > Unknown error</ h1 >
45
48
< p className = "text-danger-foreground/80 text-sm" >
46
49
An unknown error occurred. Please try again later.
47
50
</ p >
51
+ < pre className = "text-danger-foreground/80 bg-danger-foreground/10 mt-4 max-h-[50vh] overflow-auto rounded-lg p-4 text-sm break-all whitespace-break-spaces" >
52
+ { error instanceof Error ? error . message : 'Unknown error' }
53
+ </ pre >
48
54
</ div >
49
55
)
50
56
}
You can’t perform that action at this time.
0 commit comments