catch connection errors in exchange update

#Fixes #1888
This commit is contained in:
Matthias 2021-08-01 20:44:26 +02:00
parent 7ed43f5a11
commit 83dab558d7

View File

@ -1,4 +1,5 @@
from common.settings import currency_code_default, currency_codes
from urllib.error import HTTPError, URLError
from djmoney.contrib.exchange.backends.base import SimpleExchangeBackend
@ -26,4 +27,9 @@ class InvenTreeExchange(SimpleExchangeBackend):
symbols = ','.join(currency_codes())
super().update_rates(base=base_currency, symbols=symbols)
try:
super().update_rates(base=base_currency, symbols=symbols)
# catch connection errors
except (HTTPError, URLError):
print('Encountered connection error while updating')