mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 08:46:22 +02:00
- Added PostHog error capturing for non-authentication errors in BaseApiService. - Refactored PostHog client initialization to ensure a single instance is used across the application.
32 lines
776 B
TypeScript
32 lines
776 B
TypeScript
"use client";
|
|
|
|
import posthog from "posthog-js";
|
|
import { useEffect } from "react";
|
|
|
|
export default function Error({
|
|
error,
|
|
reset,
|
|
}: {
|
|
error: Error & { digest?: string };
|
|
reset: () => void;
|
|
}) {
|
|
useEffect(() => {
|
|
posthog.captureException(error);
|
|
}, [error]);
|
|
|
|
return (
|
|
<div className="flex min-h-[50vh] flex-col items-center justify-center gap-4 text-center">
|
|
<h2 className="text-2xl font-semibold">Something went wrong</h2>
|
|
<p className="text-muted-foreground max-w-md">
|
|
An unexpected error occurred. Please try again.
|
|
</p>
|
|
<button
|
|
type="button"
|
|
onClick={reset}
|
|
className="rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors"
|
|
>
|
|
Try again
|
|
</button>
|
|
</div>
|
|
);
|
|
}
|