Merge pull request #989 from JoeMakuta/style/enhance-global-error-page

fix: enhance GlobalError component with improved UI and error handling
This commit is contained in:
Rohan Verma 2026-03-26 12:42:35 -07:00 committed by GitHub
commit 95bb522220
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,28 +1,32 @@
"use client"; "use client";
import NextError from "next/error"; import "./globals.css";
import posthog from "posthog-js"; import posthog from "posthog-js";
import { useEffect } from "react"; import { useEffect } from "react";
import { Button } from "@/components/ui/button";
export default function GlobalError({ export default function GlobalError({
error, error,
reset, reset,
}: { }: {
error: Error & { digest?: string }; error: Error & { digest?: string };
reset: () => void; reset: () => void;
}) { }) {
useEffect(() => { useEffect(() => {
posthog.captureException(error); posthog.captureException(error);
}, [error]); }, [error]);
return ( return (
<html lang="en"> <html lang="en">
<body> <body>
<NextError statusCode={0} /> <div className="flex min-h-screen flex-col items-center justify-center gap-4 p-4">
<button type="button" onClick={reset}> <h2 className="text-xl font-semibold">Something went wrong</h2>
Try again <p className="text-sm text-muted-foreground">
</button> An unexpected error occurred.
</body> </p>
</html> <Button onClick={reset}>Try again</Button>
); </div>
</body>
</html>
);
} }