Report the real status code when HTTP retries are exhausted#364
Merged
Conversation
When a request kept failing with a 5xx response until ErrorRetry was exhausted, IssueRetryableHttpRequest returned (0, nil, err) where err is nil since the request itself succeeded at the HTTP level. Callers then saw status code 0 with no error detail: GetObject reported "unexpected status code 0" instead of the real 503, and StoreObject returned an error with an empty message. Return the last response's status code and body instead so callers can report what actually happened.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When a request kept failing with a 5xx response until
ErrorRetrywas exhausted,IssueRetryableHttpRequest()returned(0, nil, err)— buterris nil in the 5xx case since the request itself succeeded at the HTTP level. Callers then saw status code 0 with no error detail:GetObject()reportedunexpected status code 0instead of the real 503/502.StoreObject()returnederrors.New(string(nil))— an error with an empty message.Return the last response's status code and body instead, so callers report what actually happened. The transport-error path is unchanged (status code 0 and a non-nil error, as before).
The new test asserts that GetChunk/HasChunk errors mention the real status code and that StoreChunk errors carry the response body; it fails against the previous code.