Browse Source

exchange_rate: don't log full exception trace for timeouts

```
20220222T134125.306163Z |    ERROR | exchange_rate.CoinGecko | failed fx quotes: TimeoutError()
Traceback (most recent call last):
  File "...\electrum\electrum\exchange_rate.py", line 81, in update_safe
    self.quotes = await self.get_rates(ccy)
  File "...\electrum\electrum\exchange_rate.py", line 306, in get_rates
    json = await self.get_json('api.coingecko.com', '/api/v3/exchange_rates')
  File "...\electrum\electrum\exchange_rate.py", line 65, in get_json
    async with session.get(url) as response:
  File "...\Python39\site-packages\aiohttp\client.py", line 1138, in __aenter__
    self._resp = await self._coro
  File "...\Python39\site-packages\aiohttp\client.py", line 634, in _request
    break
  File "...\Python39\site-packages\aiohttp\helpers.py", line 721, in __exit__
    raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError
```
patch-4
SomberNight 3 years ago
parent
commit
4f102d7752
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 4
      electrum/exchange_rate.py

4
electrum/exchange_rate.py

@ -80,7 +80,7 @@ class ExchangeBase(Logger):
self.logger.info(f"getting fx quotes for {ccy}")
self.quotes = await self.get_rates(ccy)
self.logger.info("received fx quotes")
except aiohttp.ClientError as e:
except (aiohttp.ClientError, asyncio.TimeoutError) as e:
self.logger.info(f"failed fx quotes: {repr(e)}")
self.quotes = {}
except Exception as e:
@ -111,7 +111,7 @@ class ExchangeBase(Logger):
self.logger.info(f"requesting fx history for {ccy}")
h = await self.request_history(ccy)
self.logger.info(f"received fx history for {ccy}")
except aiohttp.ClientError as e:
except (aiohttp.ClientError, asyncio.TimeoutError) as e:
self.logger.info(f"failed fx history: {repr(e)}")
return
except Exception as e:

Loading…
Cancel
Save