Skip to content

Commit 4757a5c

Browse files
volokluevclaude
andcommitted
fix(billing): Prevent crash on invalid data category for plan
The getBucket function would throw an error when it couldn't find a valid bucket for a data category, causing the billing overview page to crash. Now it reports the error to Sentry with full context but returns a fallback bucket with zero price, allowing the page to continue rendering. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent f2883c3 commit 4757a5c

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

static/gsApp/views/amCheckout/utils.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,23 @@ export function getBucket({
185185
return buckets[slot]!;
186186
}
187187
}
188-
throw new Error('Invalid data category for plan');
188+
189+
// Report to Sentry but don't crash the page
190+
Sentry.withScope(scope => {
191+
scope.setExtras({
192+
buckets,
193+
events,
194+
price,
195+
shouldMinimize,
196+
});
197+
Sentry.captureException(new Error('Invalid data category for plan'));
198+
});
199+
200+
// Return a fallback bucket with zero price to prevent crashes
201+
return {
202+
price: 0,
203+
quantity: events ?? 0,
204+
};
189205
}
190206

191207
type ReservedTotalProps = {

0 commit comments

Comments
 (0)