log errors from wallet servers
This commit is contained in:
parent
8cb811ca1d
commit
56fc003a96
1 changed files with 8 additions and 1 deletions
|
@ -3,7 +3,7 @@ import asyncio
|
||||||
from asyncio import CancelledError
|
from asyncio import CancelledError
|
||||||
from itertools import cycle
|
from itertools import cycle
|
||||||
|
|
||||||
from aiorpcx import RPCSession as BaseClientSession, Connector
|
from aiorpcx import RPCSession as BaseClientSession, Connector, RPCError
|
||||||
|
|
||||||
from torba import __version__
|
from torba import __version__
|
||||||
from torba.stream import StreamController
|
from torba.stream import StreamController
|
||||||
|
@ -21,6 +21,13 @@ class ClientSession(BaseClientSession):
|
||||||
self.on_disconnected = self._on_disconnect_controller.stream
|
self.on_disconnected = self._on_disconnect_controller.stream
|
||||||
self.bw_limit = self.framer.max_size = self.max_errors = 1 << 32
|
self.bw_limit = self.framer.max_size = self.max_errors = 1 << 32
|
||||||
|
|
||||||
|
async def send_request(self, method, args=()):
|
||||||
|
try:
|
||||||
|
return await super().send_request(method, args)
|
||||||
|
except RPCError as e:
|
||||||
|
log.warning("Wallet server returned an error. Code: %s Message: %s", *e.args)
|
||||||
|
raise e
|
||||||
|
|
||||||
async def create_connection(self):
|
async def create_connection(self):
|
||||||
connector = Connector(lambda: self, *self.server)
|
connector = Connector(lambda: self, *self.server)
|
||||||
await connector.create_connection()
|
await connector.create_connection()
|
||||||
|
|
Loading…
Reference in a new issue