|
@@ -379,24 +379,32 @@ class RPCClient(MMGenObject):
|
|
text,status = run_ret
|
|
text,status = run_ret
|
|
if status == 200:
|
|
if status == 200:
|
|
dmsg_rpc(' RPC RESPONSE data ==>\n{}\n',text,is_json=True)
|
|
dmsg_rpc(' RPC RESPONSE data ==>\n{}\n',text,is_json=True)
|
|
|
|
+ m = None
|
|
if batch:
|
|
if batch:
|
|
return [r['result'] for r in json.loads(text,parse_float=Decimal)]
|
|
return [r['result'] for r in json.loads(text,parse_float=Decimal)]
|
|
else:
|
|
else:
|
|
try:
|
|
try:
|
|
if json_rpc:
|
|
if json_rpc:
|
|
- return json.loads(text,parse_float=Decimal)['result']
|
|
|
|
|
|
+ ret = json.loads(text,parse_float=Decimal)['result']
|
|
|
|
+ if isinstance(ret,list) and ret and type(ret[0]) == dict and 'success' in ret[0]:
|
|
|
|
+ for res in ret:
|
|
|
|
+ if not res['success']:
|
|
|
|
+ m = str(res['error'])
|
|
|
|
+ assert False
|
|
|
|
+ return ret
|
|
else:
|
|
else:
|
|
return json.loads(text,parse_float=Decimal)
|
|
return json.loads(text,parse_float=Decimal)
|
|
except:
|
|
except:
|
|
- t = json.loads(text)
|
|
|
|
- try:
|
|
|
|
- m = t['error']['message']
|
|
|
|
- except:
|
|
|
|
|
|
+ if not m:
|
|
|
|
+ t = json.loads(text)
|
|
try:
|
|
try:
|
|
- m = t['error']
|
|
|
|
|
|
+ m = t['error']['message']
|
|
except:
|
|
except:
|
|
- m = t
|
|
|
|
- die( 'RPCFailure', m )
|
|
|
|
|
|
+ try:
|
|
|
|
+ m = t['error']
|
|
|
|
+ except:
|
|
|
|
+ m = t
|
|
|
|
+ die('RPCFailure', m)
|
|
else:
|
|
else:
|
|
import http
|
|
import http
|
|
m,s = ( '', http.HTTPStatus(status) )
|
|
m,s = ( '', http.HTTPStatus(status) )
|