From 39ba2a8b7f6969d9c53377aee1cacb0cb1277d53 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Fri, 18 Sep 2020 20:18:48 -0300 Subject: [PATCH] log errors for on_rpc --- lbry/service/daemon.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lbry/service/daemon.py b/lbry/service/daemon.py index 5af54fb52..55b67a5e2 100644 --- a/lbry/service/daemon.py +++ b/lbry/service/daemon.py @@ -137,12 +137,16 @@ class Daemon: data = await request.json() params = data.get('params', {}) method = getattr(self.api, data['method']) - result = await method(**params) - encoded_result = jsonrpc_dumps_pretty(result, service=self.service) - return Response( - text=encoded_result, - content_type='application/json' - ) + try: + result = await method(**params) + encoded_result = jsonrpc_dumps_pretty(result, service=self.service) + return Response( + text=encoded_result, + content_type='application/json' + ) + except Exception as e: + log.exception("RPC error") + raise e async def on_connect(self, request): web_socket = WebSocketManager()