Catch general HTTP errors during VAT validation

This commit is contained in:
Raphael Michel
2019-07-04 10:39:41 +02:00
parent a5e2caf438
commit 779a3698a8

View File

@@ -1,6 +1,7 @@
import copy
import logging
from decimal import Decimal
from urllib.error import HTTPError
import dateutil.parser
import pytz
@@ -451,7 +452,7 @@ class BaseInvoiceAddressForm(forms.ModelForm):
'your country is currently not available. We will therefore '
'need to charge VAT on your invoice. You can get the tax amount '
'back via the VAT reimbursement process.'))
except vat_moss.errors.WebServiceError:
except (vat_moss.errors.WebServiceError, HTTPError):
logger.exception('VAT ID checking failed for country {}'.format(data.get('country')))
self.instance.vat_id_validated = False
if self.request and self.vat_warning: