Skip to content

Commit 536e71b

Browse files
committed
feat: capture global exception
1 parent 5b44421 commit 536e71b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

app/global-error.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { ERROR_NOT_FOUND, ERROR_NOT_IMPLEMENTED, ERROR_UNAUTHORIZED, ERROR_USER_
88
import { CombinedGraphQLErrors, CombinedProtocolErrors } from "@apollo/client";
99
import { AlertCircle, Code, Home, Lock, RefreshCw, Search, Shield, WifiOff } from "lucide-react";
1010
import Link from "next/link";
11+
import posthog from "posthog-js";
1112
import { useEffect } from "react";
1213

1314
interface GlobalErrorProps {
@@ -111,8 +112,10 @@ export default function GlobalError({ error, reset }: GlobalErrorProps) {
111112
const errorInfo = getErrorInfo(error);
112113

113114
useEffect(() => {
114-
// Log error to monitoring service
115-
console.error("Global error:", error);
115+
posthog.captureException(error, {
116+
url: window.location.href,
117+
digest: error.digest,
118+
});
116119
}, [error]);
117120

118121
return (

0 commit comments

Comments
 (0)