Skip to content

Commit

Permalink
Problem: A duplicate tx may result in HTTP 500.
Browse files Browse the repository at this point in the history
* Improve parsing of errors received from Tendermint RPC.
  • Loading branch information
shahbazn authored and ldmberman committed Sep 13, 2018
1 parent f55f221 commit c68fab6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion bigchaindb/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,14 @@ def _process_post_response(self, response, mode):

error = response.get('error')
if error:
return (500, error)
status_code = 500
message = error.get('message', 'Internal Error')
data = error.get('data', '')

if 'Tx already exists in cache' in data:
status_code = 400

return (status_code, message + ' - ' + data)

result = response['result']
if mode == self.mode_commit:
Expand Down

0 comments on commit c68fab6

Please sign in to comment.