所有 129 个 error.tsx 客户端错误边界接入 useErrorReport Hook,客户端路由错误自动上报到 /api/client-error 端点,服务端通过 pino logger 统一记录。移除了 7 处 useEffect + console.error 调用。为无 props 的 error.tsx 补全 error 参数解构。
30 lines
789 B
TypeScript
30 lines
789 B
TypeScript
"use client"
|
|
|
|
import { AlertCircle } from "lucide-react"
|
|
import { useTranslations } from "next-intl"
|
|
|
|
import { EmptyState } from "@/shared/components/ui/empty-state"
|
|
import { useErrorReport } from "@/shared/hooks/use-error-report"
|
|
|
|
export default function DataChangeLogsError({
|
|
error,
|
|
reset,
|
|
}: {
|
|
error: Error & { digest?: string }
|
|
reset: () => void
|
|
}) {
|
|
const t = useTranslations("audit")
|
|
useErrorReport(error)
|
|
return (
|
|
<div className="flex h-full flex-col items-center justify-center space-y-4 p-8">
|
|
<EmptyState
|
|
icon={AlertCircle}
|
|
title={t("error.title")}
|
|
description={t("error.description")}
|
|
action={{ label: t("error.retry"), onClick: () => reset() }}
|
|
className="border-none shadow-none h-auto"
|
|
/>
|
|
</div>
|
|
)
|
|
}
|