plz explain errors

This commit is contained in:
Alex Grintsvayg 2019-11-14 09:52:30 -05:00
parent 68d1157495
commit 37161057c6
No known key found for this signature in database
GPG key ID: AEB3F089F86A22B5

View file

@ -3,6 +3,7 @@ import math
import time
import base64
import asyncio
import logging
from binascii import hexlify
from pylru import lrucache
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
@ -18,6 +19,8 @@ from lbry.wallet.server.websocket import AdminWebSocket
from lbry.wallet.server.metrics import ServerLoadData, APICallMetrics
from lbry import __version__ as sdk_version
log = logging.getLogger(__name__)
class ResultCacheItem:
__slots__ = '_result', 'lock', 'has_result'
@ -131,6 +134,8 @@ class LBRYElectrumX(ElectrumX):
result = await asyncio.get_running_loop().run_in_executor(
self.session_mgr.query_executor, func, kwargs
)
except asyncio.CancelledError:
raise
except reader.SQLiteInterruptedError as error:
metrics = self.get_metrics_or_placeholder_for_api(query_name)
metrics.query_interrupt(start, error.metrics)
@ -139,7 +144,8 @@ class LBRYElectrumX(ElectrumX):
metrics = self.get_metrics_or_placeholder_for_api(query_name)
metrics.query_error(start, error.metrics)
raise RPCError(JSONRPC.INTERNAL_ERROR, 'query failed to execute')
except:
except Exception:
log.exception("dear devs, please handle this exception better")
metrics = self.get_metrics_or_placeholder_for_api(query_name)
metrics.query_error(start, {})
raise RPCError(JSONRPC.INTERNAL_ERROR, 'unknown server error')