Waiter throw ClientError for unexpected error response #957
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Waiter should throw ClientError for unexpected error response
Problem
During a waiters wait() routine, if the botocore client throws a ClientError, and there is no Acceptor in the JSON configured to handle that specific ClientError response, then a less informative WaiterError is thrown.
In doing so, error response information is lost (such as the Error Code), making it impossible to accurately detect certain errors (namely, 5xx errors and ThrottlingException, per http://docs.aws.amazon.com/general/latest/gr/api-retries.html
This "WaiterError" is caused by a regular ClientError, and has no specific connection to Waiter logic, other than it happened during waiting (unlike other WaiterErrors, which are for waiter-specific failure conditions like "max retries exceeded")
Solution
If a ClientError occurs, and there is no Waiter logic ("acceptors") that handles it, then propagate a ClientError with all of the original information
BTW...
tests/unit/test_waters.TestWaitersObjects.test_unspecified_errors_propagate_error_code does not actually test that unspecified errors propogate the Error Code; it tests that they propogate the Error Message (won't matter if this change gets submitted)
If this change is rejected, please consider actually including the Error Code somewhere in WaiterError. Maybe also the HTTP Response Code?