add global error handle

This commit is contained in:
DefectingCat
2023-12-26 10:09:56 +08:00
parent a5a0a8029b
commit 3a6a3bf631
3 changed files with 31 additions and 2 deletions

View File

@ -12,7 +12,7 @@ const page = () => {
<> <>
<AboutModel /> <AboutModel />
<main className="h-[calc(100vh-142px)] flex flex-col"> <main className="h-[calc(100dvh-142px)] flex flex-col">
<div <div
className={clsx( className={clsx(
'flex max-w-3xl', 'flex max-w-3xl',

29
app/global-error.tsx Normal file
View File

@ -0,0 +1,29 @@
'use client';
import clsx from 'clsx';
import Button from 'components/rua/button';
const GlobalError = ({
error,
reset,
}: {
error: Error & { digest?: string };
reset: () => void;
}) => {
return (
<html>
<body
className={clsx('w-full h-dvh flex', 'justify-center items-center')}
>
<div>
<h2 className="text-xl text-subtext1">
Something went wrong! ( OωO)
</h2>
<Button onClick={() => reset()}>Try again</Button>
</div>
</body>
</html>
);
};
export default GlobalError;

View File

@ -41,7 +41,7 @@ export default function RootLayout({
</head> </head>
<body> <body>
<RUAThemeProvider> <RUAThemeProvider>
<div className="flex flex-col min-h-[100vh]"> <div className="flex flex-col min-h-dvh">
<HeadBar /> <HeadBar />
{children} {children}
<Footer /> <Footer />