Check for the error field first.

This commit is contained in:
Lev Berman 2018-09-06 14:02:01 +02:00
parent 4b6d30f20d
commit ba4246d424

View File

@ -96,6 +96,10 @@ class BigchainDB(object):
def _process_post_response(self, response, mode):
logger.debug(response)
error = response.get('error')
if error:
return (500, error)
result = response['result']
if mode == self.mode_commit:
check_tx_code = result.get('check_tx', {}).get('code', 0)
@ -104,10 +108,6 @@ class BigchainDB(object):
else:
error_code = result.get('code', 0)
error = response.get('error')
if error:
return (500, error)
if error_code:
return (500, 'Transaction validation failed')