From 469fdc2f70617ef07018acc7f964058331e00100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Thu, 29 Jun 2017 11:26:30 +0200 Subject: [PATCH] Delay call to stripe when there is a connection error issue6610 review37531002 --- payment.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/payment.py b/payment.py index c8878268bf..2f57b7ffcf 100644 --- a/payment.py +++ b/payment.py @@ -227,8 +227,9 @@ class Payment: for payment in payments: try: charge = stripe.Charge.create(**payment._charge_parameters()) - except stripe.error.RateLimitError: - logger.warning("Rate limit error") + except (stripe.error.RateLimitError, + stripe.error.APIConnectionError) as e: + logger.warning(str(e)) continue except stripe.error.StripeError as e: payment.stripe_error_message = unicode(e) @@ -286,8 +287,9 @@ class Payment: payment.stripe_charge_id, api_key=payment.journal.stripe_account.secret_key) charge.capture(**payment._capture_parameters()) - except stripe.error.RateLimitError: - logger.warning("Rate limit error") + except (stripe.error.RateLimitError, + stripe.error.APIConnectionError) as e: + logger.warning(str(e)) continue except stripe.error.StripeError as e: payment.stripe_error_message = unicode(e)