Log Stripe errors when trying to delete customer/subscription
Call `log.exception` instead of just `pass` to log these errors and know what's
happening in production.
@@ -20,7 +20,10 @@ def delete_customer(customer_id):
customer = stripe.Customer.retrieve(customer_id)
return customer.delete()
except stripe.error.InvalidRequestError:
- pass
+ log.exception(
+ 'Customer not deleted. Customer not found on Stripe. customer=%s',
+ customer_id,
+ )
def cancel_subscription(customer_id, subscription_id):
@@ -31,4 +34,9 @@ def cancel_subscription(customer_id, subscription_id):
subscription = customer.subscriptions.retrieve(subscription_id)
return subscription.delete()
except stripe.error.StripeError:
- pass
+ log.exception(
+ 'Subscription not cancelled. Customer/Subscription not found on Stripe. '
+ 'customer=%s subscription=%s',
+ customer_id,
+ subscription_id,
+ )
