docker: export UnexpectedHTTPStatusError#2801
Merged
Luap99 merged 3 commits intocontainers:mainfrom Mar 24, 2025
Merged
Conversation
mtrmac
requested changes
Mar 21, 2025
Collaborator
mtrmac
left a comment
There was a problem hiding this comment.
Thanks! The API makes sense.
To be universal: There is also getExternalBlob (though I’m unsure what exactly to do there), getOneSignature, and httpResponseToError. At least the last one is invoked on ~every operation, as one of the first requests, so it might frequently be the one that actually reports a failure.
mtrmac
reviewed
Mar 21, 2025
Some callers might like to make decisions based on the http server error that was returned. In particular we would like c/common/pkg/retry to match this error so it can retry image pulls/pushes on 5XX errors as they seems to be a quite common problem[1]. [1] containers/common#2299 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
mtrmac
reviewed
Mar 21, 2025
Collaborator
mtrmac
left a comment
There was a problem hiding this comment.
LGTM, please merge (or ping me) whenever appropriate.
(I wouldn’t mind a newUnexpectedHTTPStatusError(*http.Response) helper, but this is simple enough, and I don’t expect many more instances to be added in the future.)
mtrmac
approved these changes
Mar 21, 2025
Add a small helper to create the error directly from the http response without having to set the struct fields at each caller. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
So that callers can actually check the status code of all requests if needed. This changes error text slightly but I think it still carries the same meaning. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Member
Author
|
Added the new helper function as well |
mtrmac
approved these changes
Mar 24, 2025
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.
Some callers might like to make decisions based on the http server error that was returned.
In particular we would like c/common/pkg/retry to match this error so it can retry image pulls/pushes on 5XX errors as they seems to be a quite common problem[1].
[1] containers/common#2299