mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-04 05:12:38 +02:00
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:
commit
95bb522220
1 changed files with 22 additions and 18 deletions
|
|
@ -1,28 +1,32 @@
|
|||
"use client";
|
||||
|
||||
import NextError from "next/error";
|
||||
import "./globals.css";
|
||||
import posthog from "posthog-js";
|
||||
import { useEffect } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
export default function GlobalError({
|
||||
error,
|
||||
reset,
|
||||
error,
|
||||
reset,
|
||||
}: {
|
||||
error: Error & { digest?: string };
|
||||
reset: () => void;
|
||||
error: Error & { digest?: string };
|
||||
reset: () => void;
|
||||
}) {
|
||||
useEffect(() => {
|
||||
posthog.captureException(error);
|
||||
}, [error]);
|
||||
useEffect(() => {
|
||||
posthog.captureException(error);
|
||||
}, [error]);
|
||||
|
||||
return (
|
||||
<html lang="en">
|
||||
<body>
|
||||
<NextError statusCode={0} />
|
||||
<button type="button" onClick={reset}>
|
||||
Try again
|
||||
</button>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
return (
|
||||
<html lang="en">
|
||||
<body>
|
||||
<div className="flex min-h-screen flex-col items-center justify-center gap-4 p-4">
|
||||
<h2 className="text-xl font-semibold">Something went wrong</h2>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
An unexpected error occurred.
|
||||
</p>
|
||||
<Button onClick={reset}>Try again</Button>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue