From 838e066dbdf69d06ce2ea5dd201c1bafa2fca344 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Wed, 20 May 2026 10:55:25 +0530 Subject: [PATCH] feat: add dedicated 402 budget limit error page 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. --- src/routes/(console)/+error.svelte | 75 +++++++++++++++---- .../project-[region]-[project]/+error.svelte | 36 ++++++++- 2 files changed, 95 insertions(+), 16 deletions(-) diff --git a/src/routes/(console)/+error.svelte b/src/routes/(console)/+error.svelte index 41863e61a..ec00cecb1 100644 --- a/src/routes/(console)/+error.svelte +++ b/src/routes/(console)/+error.svelte @@ -5,7 +5,12 @@ import { Button } from '$lib/elements/forms'; import { isVerifyEmailRedirectError } from '$lib/helpers/emailVerification'; import { Container } from '$lib/layout'; - import { Typography } from '@appwrite.io/pink-svelte'; + import { Badge, Layout, Typography } from '@appwrite.io/pink-svelte'; + + const isPaymentError = $derived(page.status === 402); + const billingUrl = $derived( + page.params.organization ? `${base}/organization-${page.params.organization}/billing` : null + ); $effect(() => { const verifyEmailPath = resolve('/verify-email'); @@ -15,15 +20,59 @@ }); - -
- {'status' in page.error - ? page.error.status || 'Invalid Argument' - : 'Invalid Argument'} - {page.error.message} -
-
- -
-
+{#if isPaymentError} +
+
+ + + + + Your organization has reached its budget limit + + + Access to resources has been blocked. Update your billing settings to + restore access. + + +
+ + {#if billingUrl} + + {/if} + + +
+
+
+
+{:else} + +
+ {'status' in page.error + ? page.error.status || 'Invalid Argument' + : 'Invalid Argument'} + {page.error.message} +
+
+ +
+
+{/if} + + diff --git a/src/routes/(console)/project-[region]-[project]/+error.svelte b/src/routes/(console)/project-[region]-[project]/+error.svelte index 602d88337..ab7473aa1 100644 --- a/src/routes/(console)/project-[region]-[project]/+error.svelte +++ b/src/routes/(console)/project-[region]-[project]/+error.svelte @@ -1,12 +1,12 @@ -{#if page.error.type === 'general_resource_blocked'} +{#if isPaymentError} +
+
+ + + + + Your organization has reached its budget limit + + + Access to this resource has been blocked. Update your billing settings to + restore access. + + +
+ + {#if billingUrl} + + {/if} + + +
+
+
+
+{:else if page.error.type === 'general_resource_blocked'}