Problem: Error response not handled in POST transaction to tendermint (#2219)

Solution: Handle the error response
This commit is contained in:
Vanshdeep Singh 2018-04-17 16:39:43 +02:00 committed by vrde
parent 0cf0927193
commit 1823818315
1 changed files with 9 additions and 8 deletions

View File

@ -62,15 +62,16 @@ class BigchainDB(Bigchain):
def _process_post_response(self, response, mode):
logger.debug(response)
result = response['result']
if mode == MODE_LIST[1]:
status_code = result['check_tx']['code']
return self._process_status_code(status_code,
'Error while validating the transaction')
elif mode == MODE_LIST[2]:
return self._process_commit_mode_response(result)
if response.get('error') is not None:
return (500, 'Internal error')
return (202, '')
result = response['result']
if mode == MODE_LIST[2]:
return self._process_commit_mode_response(result)
else:
status_code = result['code']
return self._process_status_code(status_code,
'Error while processing transaction')
def _process_commit_mode_response(self, result):
check_tx_status_code = result['check_tx']['code']