Sitelet https://github.com/jgarzik/python-bitcoinrpc/commit/d5f45dadce4dea0da415b1108b867fce273caab1
Skip to content

Commit d5f45da

Browse files
author
Jeff Garzik
committed
Merge pull request #51 from p2pmining/no_error_in_result
If RPC response doesn't have {error:} throws error
2 parents 65206ca + 5409b02 commit d5f45da

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎bitcoinrpc/authproxy.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,9 @@ def __call__(self, *args):
137137
self.__conn.sock.settimeout(self.__timeout)
138138

139139
response = self._get_response()
140-
if response['error'] is not None:
141-
raise JSONRPCException(response['error'])
140+
if 'error' in response:
141+
if response['error'] is not None:
142+
raise JSONRPCException(response['error'])
142143
elif 'result' not in response:
143144
raise JSONRPCException({
144145
'code': -343, 'message': 'missing JSON-RPC result'})

0 commit comments

Comments
 (0)