Skip to content

Commit 54b956c

Browse files
committed
feat: event tracking errors
1 parent ae7d2a1 commit 54b956c

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

studio/src/components/onboarding/step-1.tsx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,19 @@ export const Step1 = () => {
6262
const { mutate, isPending } = useMutation(createOnboarding, {
6363
onSuccess: (d) => {
6464
if (d.response?.code !== EnumStatusCode.OK) {
65+
const description = d.response?.details ?? 'We had issues with storing your data. Please try again.';
6566
toast({
66-
description: d.response?.details ?? 'We had issues with storing your data. Please try again.',
67+
description,
6768
duration: 3000,
6869
});
70+
captureOnboardingEvent(posthog, {
71+
name: 'onboarding_step_failed',
72+
options: {
73+
step_name: 'welcome',
74+
error_category: 'resource',
75+
error_message: description,
76+
},
77+
});
6978
return;
7079
}
7180

@@ -85,10 +94,19 @@ export const Step1 = () => {
8594
router.push('/onboarding/2');
8695
},
8796
onError: (error) => {
97+
const description = error.details.toString() ?? 'We had issues with storing your data. Please try again.';
8898
toast({
89-
description: error.details.toString() ?? 'We had issues with storing your data. Please try again.',
99+
description,
90100
duration: 3000,
91101
});
102+
captureOnboardingEvent(posthog, {
103+
name: 'onboarding_step_failed',
104+
options: {
105+
step_name: 'welcome',
106+
error_category: 'resource',
107+
error_message: description,
108+
},
109+
});
92110
},
93111
});
94112

studio/src/components/onboarding/step-2.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,19 @@ export const Step2 = () => {
141141

142142
const status = getDemoGraphStatus({ data, isPolling: polling.active, isError });
143143

144+
useEffect(() => {
145+
if (status !== 'fail' && status !== 'error') return;
146+
147+
captureOnboardingEvent(posthog, {
148+
name: 'onboarding_step_failed',
149+
options: {
150+
step_name: 'create_graph',
151+
error_category: 'resource',
152+
error_message: status === 'error' ? 'Failed to fetch federated graph data' : 'Demo federated graph not created',
153+
},
154+
});
155+
}, [status, posthog]);
156+
144157
return (
145158
<OnboardingContainer>
146159
<div className="mt-4 flex w-full flex-col gap-6 text-left">

0 commit comments

Comments
 (0)