forked from LBRYCommunity/lbry-sdk
return errors when websocket req fails
This commit is contained in:
parent
9b15799c72
commit
6bbfb45de7
1 changed files with 13 additions and 6 deletions
|
@ -152,12 +152,19 @@ class Daemon:
|
|||
else:
|
||||
params = msg.get('params', {})
|
||||
method = getattr(self.api, msg['method'])
|
||||
try:
|
||||
result = await method(**params)
|
||||
encoded_result = jsonrpc_dumps_pretty(result, service=self.service)
|
||||
await web_socket.send_json({
|
||||
'id': msg.get('id', ''),
|
||||
'result': encoded_result
|
||||
})
|
||||
except Exception as e:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
log.exception("RPC error")
|
||||
await web_socket.send_json({'id': msg.get('id', ''), 'result': "unexpected error: " + str(e)})
|
||||
raise e
|
||||
|
||||
@staticmethod
|
||||
async def on_shutdown(app):
|
||||
|
|
Loading…
Reference in a new issue