Skip to content

feat: add dedicated 402 budget limit error page#3052

Merged
HarshMN2345 merged 3 commits into
mainfrom
fix-402-budget-limit-error-page
May 20, 2026
Merged

feat: add dedicated 402 budget limit error page#3052
HarshMN2345 merged 3 commits into
mainfrom
fix-402-budget-limit-error-page

Conversation

@HarshMN2345
Copy link
Copy Markdown
Member

@HarshMN2345 HarshMN2345 commented May 20, 2026

Replace generic error display for 402 responses with a dedicated budget limit error page. Includes a 'Go to billing' CTA when an organization is in context, and a 'Change organization' secondary action on both console-level and project-level error pages.

What does this PR do?

image image

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

Related PRs and Issues

(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

Have you read the Contributing Guidelines on issues?

(Write your answer here.)

Replace generic error display for 402 responses with a dedicated
budget limit error page. Includes a 'Go to billing' CTA when an
organization is in context, and a 'Change organization' secondary
action on both console-level and project-level error pages.
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 20, 2026

Greptile Summary

This PR replaces the generic error display for HTTP 402 responses with a dedicated "billing limit reached" page in both the console-level and project-level error boundaries. Each page shows a styled badge, an error message, a conditional "Go to billing" CTA, and a "Change organization" fallback button.

  • (console)/+error.svelte — migrated to Svelte 5 runes; derives billingUrl from page.params.organization, so the billing CTA is absent when the error occurs outside an organization-scoped route (intentional, no org = no known billing target).
  • (console)/project-[region]-[project]/+error.svelte — adds a 402 branch ahead of the existing general_resource_blocked branch; billingUrl is resolved from the $organization store. Still uses Svelte 4 $: reactive syntax (pre-existing in this file, flagged in an earlier review thread).

Confidence Score: 5/5

Safe to merge — the changes are additive UI-only modifications to error boundary pages with no shared state mutations or breaking contract changes.

Both error pages add a straightforward conditional branch for 402 responses. The billing URL derivation logic is simple and fails safely (null → no button rendered). The console-level file correctly uses Svelte 5 runes; the project-level file's legacy syntax is a pre-existing concern already raised in a prior review thread. No data-layer or auth-path changes are present.

No files require special attention.

Important Files Changed

Filename Overview
src/routes/(console)/+error.svelte Adds a dedicated 402 billing-limit error layout using Svelte 5 runes ($derived); billing URL is derived from page.params.organization, correctly resolving to null when no org is in the route context.
src/routes/(console)/project-[region]-[project]/+error.svelte Adds a 402 branch before the existing general_resource_blocked branch; billing URL is resolved from the $organization store. Still uses legacy $: reactive declarations (noted in a prior thread). Logic is otherwise correct.

Reviews (2): Last reviewed commit: "fix: use backend error message on 402 bi..." | Re-trigger Greptile

Comment on lines +20 to +22
$: orgId = $organization?.$id;
$: billingUrl = orgId ? `${base}/organization-${orgId}/billing` : null;
$: isPaymentError = page.status === 402;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Svelte 4 reactive declarations on a touched file

The three new reactive statements use legacy $: syntax (Svelte 4), but AGENTS.md requires migrating a file to Svelte 5 runes when it is modified ("When touching a file, migrate it to runes if practical. Don't mix syntaxes within a single component."). The sibling (console)/+error.svelte was already in runes mode and uses $derived for the equivalent variables; keeping this file on $: means the two error pages diverge in style unnecessarily. The existing $: statements for allOrgsHavePremiumSupport and hasPremiumSupport should also be converted as part of the same pass.

Context Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment thread src/routes/(console)/project-[region]-[project]/+error.svelte
402 can be triggered by various billing limits, not only budget caps.
Update copy to reflect this.
@HarshMN2345 HarshMN2345 merged commit 3ac7af9 into main May 20, 2026
4 checks passed
@HarshMN2345 HarshMN2345 deleted the fix-402-budget-limit-error-page branch May 20, 2026 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants