Merge pull request #1890 from matmair/fix-for-1888

catch connection errors in exchange update

(cherry picked from commit db57e9516b)
This commit is contained in:
Oliver 2021-08-02 08:34:52 +10:00
parent 0e59c15773
commit cd39fd1dc2

View File

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