mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-15 16:51:37 +00:00
add global error handle
This commit is contained in:
@ -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
29
app/global-error.tsx
Normal 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;
|
@ -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 />
|
||||||
|
Reference in New Issue
Block a user