log errors for on_rpc

This commit is contained in:
Victor Shyba 2020-09-18 20:18:48 -03:00 committed by Lex Berezhny
parent 25b63c988f
commit 39ba2a8b7f

View file

@ -137,12 +137,16 @@ class Daemon:
data = await request.json() data = await request.json()
params = data.get('params', {}) params = data.get('params', {})
method = getattr(self.api, data['method']) method = getattr(self.api, data['method'])
result = await method(**params) try:
encoded_result = jsonrpc_dumps_pretty(result, service=self.service) result = await method(**params)
return Response( encoded_result = jsonrpc_dumps_pretty(result, service=self.service)
text=encoded_result, return Response(
content_type='application/json' text=encoded_result,
) content_type='application/json'
)
except Exception as e:
log.exception("RPC error")
raise e
async def on_connect(self, request): async def on_connect(self, request):
web_socket = WebSocketManager() web_socket = WebSocketManager()