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:
parent
0e59c15773
commit
cd39fd1dc2
|
|
@ -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())
|
||||||
|
|
||||||
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')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue