SurfSense/surfsense_web/app/global-error.tsx
DESKTOP-RTLN3BA\$punk 1ab395a34e feat: enhance error handling with PostHog integration
- Added PostHog error capturing for non-authentication errors in BaseApiService.
- Refactored PostHog client initialization to ensure a single instance is used across the application.
2026-03-12 01:28:39 -07:00

28 lines
482 B
TypeScript

"use client";
import posthog from "posthog-js";
import NextError from "next/error";
import { useEffect } from "react";
export default function GlobalError({
error,
reset,
}: {
error: Error & { digest?: string };
reset: () => void;
}) {
useEffect(() => {
posthog.captureException(error);
}, [error]);
return (
<html lang="en">
<body>
<NextError statusCode={0} />
<button type="button" onClick={reset}>
Try again
</button>
</body>
</html>
);
}