Skip to content

Commit

Permalink
chore: global error
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Feb 29, 2024
1 parent e676c3f commit fe234f4
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/app/global-error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,30 @@ import { domAnimation, LazyMotion } from 'framer-motion'
import { NormalContainer } from '~/components/layout/container/Normal'
import { StyledButton } from '~/components/ui/button'

export default function Error({ error }: any) {
export default function GlobalError({
error,
reset,
}: {
error: Error & { digest?: string }
reset: () => void
}) {
useEffect(() => {
console.log(error)
// captureException(error)
}, [error])
return (
<html>
<head>
<title>出错啦</title>
<title>禁止访问或者 API 服务出现问题</title>
</head>
<body>
<NormalContainer>
<p>{error?.message || '未知错误'}</p>
<LazyMotion features={domAnimation}>
<StyledButton onClick={location.reload}>重试</StyledButton>
</LazyMotion>
<h1 className="mb-4">禁止访问或者 API 服务出现问题</h1>
<div className="flex justify-center">
<LazyMotion features={domAnimation}>
<StyledButton onClick={location.reload}>重试</StyledButton>
</LazyMotion>
</div>
</NormalContainer>
</body>
</html>
Expand Down

0 comments on commit fe234f4

Please sign in to comment.