mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 04:26:44 +00:00
Merge pull request #1890 from matmair/fix-for-1888
catch connection errors in exchange update (cherry picked from commit db57e9516bbb53f008a970331b83939c7e007d57)
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…
x
Reference in New Issue
Block a user