71 lines
1.7 KiB
TypeScript
71 lines
1.7 KiB
TypeScript
|
|
"use client";
|
||
|
|
|
||
|
|
export default function GlobalError({
|
||
|
|
error,
|
||
|
|
reset,
|
||
|
|
}: {
|
||
|
|
error: Error & { digest?: string };
|
||
|
|
reset: () => void;
|
||
|
|
}) {
|
||
|
|
return (
|
||
|
|
<html lang="en">
|
||
|
|
<body
|
||
|
|
style={{
|
||
|
|
fontFamily:
|
||
|
|
"system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif",
|
||
|
|
background: "#0b0b10",
|
||
|
|
color: "#e5e5e7",
|
||
|
|
minHeight: "100vh",
|
||
|
|
margin: 0,
|
||
|
|
display: "flex",
|
||
|
|
alignItems: "center",
|
||
|
|
justifyContent: "center",
|
||
|
|
padding: 24,
|
||
|
|
}}
|
||
|
|
>
|
||
|
|
<div style={{ maxWidth: 480, textAlign: "center" }}>
|
||
|
|
<h1 style={{ fontSize: 22, fontWeight: 700, marginBottom: 8 }}>
|
||
|
|
The dashboard hit a fatal error
|
||
|
|
</h1>
|
||
|
|
<p
|
||
|
|
style={{
|
||
|
|
fontSize: 14,
|
||
|
|
color: "#9ca3af",
|
||
|
|
wordBreak: "break-word",
|
||
|
|
marginBottom: 16,
|
||
|
|
}}
|
||
|
|
>
|
||
|
|
{error.message || "Unexpected error"}
|
||
|
|
</p>
|
||
|
|
{error.digest && (
|
||
|
|
<p
|
||
|
|
style={{
|
||
|
|
fontSize: 11,
|
||
|
|
color: "#6b7280",
|
||
|
|
fontFamily: "ui-monospace, Menlo, monospace",
|
||
|
|
marginBottom: 16,
|
||
|
|
}}
|
||
|
|
>
|
||
|
|
ref: {error.digest}
|
||
|
|
</p>
|
||
|
|
)}
|
||
|
|
<button
|
||
|
|
onClick={reset}
|
||
|
|
style={{
|
||
|
|
background: "#f1f5f9",
|
||
|
|
color: "#0b0b10",
|
||
|
|
border: 0,
|
||
|
|
borderRadius: 6,
|
||
|
|
padding: "8px 16px",
|
||
|
|
fontWeight: 600,
|
||
|
|
cursor: "pointer",
|
||
|
|
}}
|
||
|
|
>
|
||
|
|
Try again
|
||
|
|
</button>
|
||
|
|
</div>
|
||
|
|
</body>
|
||
|
|
</html>
|
||
|
|
);
|
||
|
|
}
|