Browse Source

local jsonrpc: log exceptions daemon-side

dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
SomberNight 5 years ago
parent
commit
0534f937ab
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 7
      electrum/daemon.py

7
electrum/daemon.py

@ -36,6 +36,7 @@ from base64 import b64decode
import jsonrpcclient import jsonrpcclient
import jsonrpcserver import jsonrpcserver
from jsonrpcserver import response
from jsonrpcclient.clients.aiohttp_client import AiohttpClient from jsonrpcclient.clients.aiohttp_client import AiohttpClient
from .network import Network from .network import Network
@ -224,10 +225,12 @@ class Daemon(Logger):
try: try:
self.authenticate(request.headers) self.authenticate(request.headers)
except AuthenticationError: except AuthenticationError:
return web.Response(text='Forbidden', status='403') return web.Response(text='Forbidden', status=403)
request = await request.text() request = await request.text()
self.logger.info(f'request: {request}') #self.logger.info(f'handling request: {request}')
response = await jsonrpcserver.async_dispatch(request, methods=self.methods) response = await jsonrpcserver.async_dispatch(request, methods=self.methods)
if isinstance(response, jsonrpcserver.response.ExceptionResponse):
self.logger.error(f"error handling request: {request}", exc_info=response.exc)
if response.wanted: if response.wanted:
return web.json_response(response.deserialized(), status=response.http_status) return web.json_response(response.deserialized(), status=response.http_status)
else: else:

Loading…
Cancel
Save