electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 13563697f53e4660aad29b10b3e91abd43c27955
parent 57768244bbb1997c3f45a41fa8217d1779cc8105
Author: SomberNight <somber.night@protonmail.com>
Date:   Fri, 20 Nov 2020 01:45:11 +0100

exchange_rate: log full traceback in case of unexpected exception

related: #6748

Diffstat:
Melectrum/exchange_rate.py | 11+++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/electrum/exchange_rate.py b/electrum/exchange_rate.py @@ -11,6 +11,7 @@ from decimal import Decimal from typing import Sequence, Optional from aiorpcx.curio import timeout_after, TaskTimeout, TaskGroup +import aiohttp from . import util from .bitcoin import COIN @@ -82,9 +83,12 @@ class ExchangeBase(Logger): except asyncio.CancelledError: # CancelledError must be passed-through for cancellation to work raise - except BaseException as e: + except aiohttp.ClientError as e: self.logger.info(f"failed fx quotes: {repr(e)}") self.quotes = {} + except Exception as e: + self.logger.exception(f"failed fx quotes: {repr(e)}") + self.quotes = {} self.on_quotes() def read_historical_rates(self, ccy, cache_dir) -> Optional[dict]: @@ -110,9 +114,12 @@ 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 BaseException as e: + except aiohttp.ClientError as e: self.logger.info(f"failed fx history: {repr(e)}") return + except Exception as e: + self.logger.exception(f"failed fx history: {repr(e)}") + return filename = os.path.join(cache_dir, self.name() + '_' + ccy) with open(filename, 'w', encoding='utf-8') as f: f.write(json.dumps(h))