commit ab81a09de2e16501315ca25007c0e079c100ac59
parent d17e6a1b87aa59dc0156106a0d2bae61efb0db17
Author: SomberNight <somber.night@protonmail.com>
Date: Tue, 28 May 2019 21:23:06 +0200
interface: hide some server-induced errors from log
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/electrum/interface.py b/electrum/interface.py
@@ -328,6 +328,9 @@ class Interface(Logger):
return await func(self, *args, **kwargs)
except GracefulDisconnect as e:
self.logger.log(e.log_level, f"disconnecting due to {repr(e)}")
+ except aiorpcx.jsonrpc.RPCError as e:
+ self.logger.warning(f"disconnecting due to {repr(e)}")
+ self.logger.debug(f"(disconnect) trace for {repr(e)}", exc_info=True)
finally:
await self.network.connection_down(self)
self.got_disconnected.set_result(1)
@@ -454,8 +457,10 @@ class Interface(Logger):
await group.spawn(self.run_fetch_blocks)
await group.spawn(self.monitor_connection)
except aiorpcx.jsonrpc.RPCError as e:
- if e.code in (JSONRPC.EXCESSIVE_RESOURCE_USAGE, JSONRPC.SERVER_BUSY):
- raise GracefulDisconnect(e, log_level=logging.ERROR) from e
+ if e.code in (JSONRPC.EXCESSIVE_RESOURCE_USAGE,
+ JSONRPC.SERVER_BUSY,
+ JSONRPC.METHOD_NOT_FOUND):
+ raise GracefulDisconnect(e, log_level=logging.WARNING) from e
raise
async def monitor_connection(self):