mirror of https://github.com/containers/image.git
Use registryHTTPResponseToError on /tags/list failure
We should have been doing that from the start, in order to get server-reported errors correctly. NOTE: This can break existing clients, notably (skopeo inspect) which greps the error string for 401 and 403. See the corresponding skopeo PR for documentation of what we do about that. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
parent
5fdfa20df7
commit
f7ab2cc9f0
|
|
@ -77,8 +77,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 {
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ func TestRegistryHTTPResponseToError(t *testing.T) {
|
|||
var e errcode.Error
|
||||
ok := errors.As(err, &e)
|
||||
require.True(t, ok)
|
||||
// Note: (skopeo inspect) is checking for this errcode.Error value
|
||||
assert.Equal(t, errcode.Error{
|
||||
Code: errcode.ErrorCodeUnknown, // The NOT_FOUND value is not defined, and turns into Unknown
|
||||
Message: "404 page not found",
|
||||
|
|
|
|||
Loading…
Reference in New Issue