From 88f50db075e63f46ad9b0ffb0ff394e02b7a1799 Mon Sep 17 00:00:00 2001 From: Dev Aggarwal Date: Tue, 27 Feb 2024 22:06:58 +0530 Subject: [PATCH] fix error on /account if stripe account not found --- app_users/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app_users/models.py b/app_users/models.py index 4c7e716e2..9299fba47 100644 --- a/app_users/models.py +++ b/app_users/models.py @@ -209,7 +209,11 @@ def search_stripe_customer(self) -> stripe.Customer | None: if not self.uid: return None if self.stripe_customer_id: - return stripe.Customer.retrieve(self.stripe_customer_id) + try: + return stripe.Customer.retrieve(self.stripe_customer_id) + except stripe.error.InvalidRequestError as e: + if e.http_status != 404: + raise try: customer = stripe.Customer.search( query=f'metadata["uid"]:"{self.uid}"'