mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
interface: forward errors
This commit is contained in:
parent
9af2c20706
commit
dd849964d1
2 changed files with 11 additions and 11 deletions
|
@ -82,10 +82,6 @@ class TcpInterface(threading.Thread):
|
||||||
error = response.get('error')
|
error = response.get('error')
|
||||||
result = response.get('result')
|
result = response.get('result')
|
||||||
|
|
||||||
if error:
|
|
||||||
print_error("received error:", response)
|
|
||||||
return
|
|
||||||
|
|
||||||
if msg_id is not None:
|
if msg_id is not None:
|
||||||
with self.lock:
|
with self.lock:
|
||||||
method, params, _id, queue = self.unanswered_requests.pop(msg_id)
|
method, params, _id, queue = self.unanswered_requests.pop(msg_id)
|
||||||
|
@ -114,6 +110,9 @@ class TcpInterface(threading.Thread):
|
||||||
self.is_ping = False
|
self.is_ping = False
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if error:
|
||||||
|
queue.put((self, {'method':method, 'params':params, 'error':error, 'id':_id}))
|
||||||
|
else:
|
||||||
queue.put((self, {'method':method, 'params':params, 'result':result, 'id':_id}))
|
queue.put((self, {'method':method, 'params':params, 'result':result, 'id':_id}))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,7 @@ class NetworkProxy(threading.Thread):
|
||||||
|
|
||||||
msg_id = response.get('id')
|
msg_id = response.get('id')
|
||||||
result = response.get('result')
|
result = response.get('result')
|
||||||
|
error = response.get('error')
|
||||||
if msg_id is not None:
|
if msg_id is not None:
|
||||||
with self.lock:
|
with self.lock:
|
||||||
method, params, callback = self.unanswered_requests.pop(msg_id)
|
method, params, callback = self.unanswered_requests.pop(msg_id)
|
||||||
|
@ -125,7 +126,7 @@ class NetworkProxy(threading.Thread):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
r = {'method':method, 'params':params, 'result':result, 'id':msg_id}
|
r = {'method':method, 'params':params, 'result':result, 'id':msg_id, 'error':error}
|
||||||
callback(r)
|
callback(r)
|
||||||
|
|
||||||
|
|
||||||
|
@ -171,11 +172,11 @@ class NetworkProxy(threading.Thread):
|
||||||
while ids:
|
while ids:
|
||||||
r = queue.get(True, timeout)
|
r = queue.get(True, timeout)
|
||||||
_id = r.get('id')
|
_id = r.get('id')
|
||||||
if _id in ids:
|
|
||||||
ids.remove(_id)
|
ids.remove(_id)
|
||||||
|
if r.get('error'):
|
||||||
|
return BaseException(r.get('error'))
|
||||||
|
result = r.get('result')
|
||||||
res[_id] = r.get('result')
|
res[_id] = r.get('result')
|
||||||
else:
|
|
||||||
raise
|
|
||||||
out = []
|
out = []
|
||||||
for _id in id2:
|
for _id in id2:
|
||||||
out.append(res[_id])
|
out.append(res[_id])
|
||||||
|
|
Loading…
Add table
Reference in a new issue