1
0
mirror of https://github.com/romanz/electrs.git synced 2024-11-19 09:54:09 +01:00

Propagate Electrum JSON RPC error

This commit is contained in:
Roman Zeyde 2021-08-28 20:05:39 +03:00
parent fe1bfe3bc1
commit fb88bccb0a

View File

@ -17,7 +17,10 @@ class Client:
msg = json.dumps(requests) + '\n' msg = json.dumps(requests) + '\n'
self.s.sendall(msg.encode('ascii')) self.s.sendall(msg.encode('ascii'))
response = json.loads(self.f.readline()) response = json.loads(self.f.readline())
try:
return [r['result'] for r in response] return [r['result'] for r in response]
except KeyError:
raise ValueError(response)
def request(method, *args): def request(method, *args):