Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use registryHTTPResponseToError on /tags/list failure
Browse files Browse the repository at this point in the history
We should have been doing that from the start, in order to
get server-reported errors correctly.

Also start using fmt.Errorf("...: %w") to get closer to Go
mainstream, now that this exists.

NOTE: This can break existing clients, notably (skopeo inspect)
which greps the error string for 401 and 403.

Sadly we don't have precise records of the original failures, so
there's no way to test; we'll just have to break them and see.

Signed-off-by: Miloslav Trmač <[email protected]>
mtrmac committed Jun 17, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 0700803 commit b887aec
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docker/docker_image.go
Original file line number Diff line number Diff line change
@@ -73,8 +73,8 @@ func GetRepositoryTags(ctx context.Context, sys *types.SystemContext, ref types.
return nil, err
}
defer res.Body.Close()
if err := httpResponseToError(res, "fetching tags list"); err != nil {
return nil, err
if res.StatusCode != http.StatusOK {
return nil, fmt.Errorf("fetching tags list: %w", registryHTTPResponseToError(res))
}

var tagsHolder struct {

0 comments on commit b887aec

Please sign in to comment.