Skip to content

Commit 95bb522

Browse files
authored
Merge pull request #989 from JoeMakuta/style/enhance-global-error-page
fix: enhance GlobalError component with improved UI and error handling
2 parents f0701a0 + 0e19d1f commit 95bb522

1 file changed

Lines changed: 22 additions & 18 deletions

File tree

surfsense_web/app/global-error.tsx

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
11
"use client";
22

3-
import NextError from "next/error";
3+
import "./globals.css";
44
import posthog from "posthog-js";
55
import { useEffect } from "react";
6+
import { Button } from "@/components/ui/button";
67

78
export default function GlobalError({
8-
error,
9-
reset,
9+
error,
10+
reset,
1011
}: {
11-
error: Error & { digest?: string };
12-
reset: () => void;
12+
error: Error & { digest?: string };
13+
reset: () => void;
1314
}) {
14-
useEffect(() => {
15-
posthog.captureException(error);
16-
}, [error]);
15+
useEffect(() => {
16+
posthog.captureException(error);
17+
}, [error]);
1718

18-
return (
19-
<html lang="en">
20-
<body>
21-
<NextError statusCode={0} />
22-
<button type="button" onClick={reset}>
23-
Try again
24-
</button>
25-
</body>
26-
</html>
27-
);
19+
return (
20+
<html lang="en">
21+
<body>
22+
<div className="flex min-h-screen flex-col items-center justify-center gap-4 p-4">
23+
<h2 className="text-xl font-semibold">Something went wrong</h2>
24+
<p className="text-sm text-muted-foreground">
25+
An unexpected error occurred.
26+
</p>
27+
<Button onClick={reset}>Try again</Button>
28+
</div>
29+
</body>
30+
</html>
31+
);
2832
}

0 commit comments

Comments
 (0)