Split up the db classes used by the different hub services #43

Merged
jackrobison merged 3 commits from cleanup-db into master 2022-05-27 18:54:21 +02:00
2 changed files with 4 additions and 10 deletions
Showing only changes of commit 76dd9c392b - Show all commits

View file

@ -347,14 +347,9 @@ INVALID_ARGS = -32602
class CodeMessageError(Exception):
@property
def code(self):
return self.args[0]
@property
def message(self):
return self.args[1]
def __init__(self, code: int, message: str):
self.code = code
self.message = message
def __eq__(self, other):
return (isinstance(other, self.__class__) and
@ -382,7 +377,6 @@ class RPCError(CodeMessageError):
pass
class DaemonError(Exception):
"""Raised when the daemon returns an error in its results."""

View file

@ -1750,7 +1750,7 @@ class LBRYElectrumX(asyncio.Protocol):
if not verbose:
return raw_tx.hex()
return self.coin.transaction(raw_tx).as_dict(self.coin)
return RPCError("No such mempool or blockchain transaction.")
return RPCError(BAD_REQUEST, "No such mempool or blockchain transaction.")
def _get_merkle_branch(self, tx_hashes, tx_pos):
"""Return a merkle branch to a transaction.