Skip to content

Commit 78946ea

Browse files
feat(analytics): add event info to the captured exceptions
1 parent f335b0b commit 78946ea

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/hooks.client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import posthog from "posthog-js";
22

3-
export function handleError({ error, status }) {
3+
export function handleError({ error, status, event }) {
44
if (status === 404) return;
5-
posthog.captureException(error);
5+
posthog.captureException(error, event);
66
}

src/hooks.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ const client = new PostHog(PUBLIC_POSTHOG_KEY, {
77
disabled: dev
88
});
99

10-
export async function handleError({ error, status }) {
10+
export async function handleError({ error, status, event }) {
1111
if (status !== 404) {
12-
client.captureException(error);
12+
client.captureException(error, undefined, event);
1313
await client.shutdown();
1414
}
1515
}

0 commit comments

Comments
 (0)