forked from LBRYCommunity/lbry-sdk
plz explain errors
This commit is contained in:
parent
68d1157495
commit
37161057c6
1 changed files with 7 additions and 1 deletions
|
@ -3,6 +3,7 @@ import math
|
||||||
import time
|
import time
|
||||||
import base64
|
import base64
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import logging
|
||||||
from binascii import hexlify
|
from binascii import hexlify
|
||||||
from pylru import lrucache
|
from pylru import lrucache
|
||||||
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
|
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.wallet.server.metrics import ServerLoadData, APICallMetrics
|
||||||
from lbry import __version__ as sdk_version
|
from lbry import __version__ as sdk_version
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ResultCacheItem:
|
class ResultCacheItem:
|
||||||
__slots__ = '_result', 'lock', 'has_result'
|
__slots__ = '_result', 'lock', 'has_result'
|
||||||
|
@ -131,6 +134,8 @@ class LBRYElectrumX(ElectrumX):
|
||||||
result = await asyncio.get_running_loop().run_in_executor(
|
result = await asyncio.get_running_loop().run_in_executor(
|
||||||
self.session_mgr.query_executor, func, kwargs
|
self.session_mgr.query_executor, func, kwargs
|
||||||
)
|
)
|
||||||
|
except asyncio.CancelledError:
|
||||||
|
raise
|
||||||
except reader.SQLiteInterruptedError as error:
|
except reader.SQLiteInterruptedError as error:
|
||||||
metrics = self.get_metrics_or_placeholder_for_api(query_name)
|
metrics = self.get_metrics_or_placeholder_for_api(query_name)
|
||||||
metrics.query_interrupt(start, error.metrics)
|
metrics.query_interrupt(start, error.metrics)
|
||||||
|
@ -139,7 +144,8 @@ class LBRYElectrumX(ElectrumX):
|
||||||
metrics = self.get_metrics_or_placeholder_for_api(query_name)
|
metrics = self.get_metrics_or_placeholder_for_api(query_name)
|
||||||
metrics.query_error(start, error.metrics)
|
metrics.query_error(start, error.metrics)
|
||||||
raise RPCError(JSONRPC.INTERNAL_ERROR, 'query failed to execute')
|
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 = self.get_metrics_or_placeholder_for_api(query_name)
|
||||||
metrics.query_error(start, {})
|
metrics.query_error(start, {})
|
||||||
raise RPCError(JSONRPC.INTERNAL_ERROR, 'unknown server error')
|
raise RPCError(JSONRPC.INTERNAL_ERROR, 'unknown server error')
|
||||||
|
|
Loading…
Reference in a new issue