diff --git a/notecard/notecard.py b/notecard/notecard.py index 8c4d5f4..50b2513 100644 --- a/notecard/notecard.py +++ b/notecard/notecard.py @@ -344,7 +344,7 @@ def Transaction(self, req, lock=True): continue if 'err' in rsp_json: - if '{io}' in rsp_json['err']: + if '{io}' in rsp_json['err'] and '{not-supported}' not in rsp_json['err']: if self._debug: print('Response has error field indicating ' + \ f'I/O error: {rsp_json}') diff --git a/test/test_notecard.py b/test/test_notecard.py index 5f8705f..08c1d06 100644 --- a/test/test_notecard.py +++ b/test/test_notecard.py @@ -294,6 +294,16 @@ def test_transaction_retries_on_io_error_in_response( assert card._transact.call_count == \ notecard.CARD_TRANSACTION_RETRIES + def test_transaction_does_not_retry_on_not_supported_error_in_response( + self, arrange_transaction_test): + card = arrange_transaction_test() + req = {"req": "hub.status"} + + with patch('notecard.notecard.json.loads', + return_value={'err': 'some error {io} {not-supported}'}): + card.Transaction(req) + assert card._transact.call_count == 1 + def test_transaction_does_not_retry_on_bad_bin_error_in_response( self, arrange_transaction_test): card = arrange_transaction_test()