Merge pull request #2052 from darrenstahlmsft/PullDenied

content.Fetch: better error when auth fails
This commit is contained in:
Derek McGowan 2018-01-24 13:20:03 -08:00 committed by GitHub
commit 8d32d9edfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -136,6 +136,9 @@ func (r *dockerResolver) Resolve(ctx context.Context, ref string) (string, ocisp
log.G(ctx).Debug("resolving") log.G(ctx).Debug("resolving")
resp, err := fetcher.doRequestWithRetries(ctx, req, nil) resp, err := fetcher.doRequestWithRetries(ctx, req, nil)
if err != nil { if err != nil {
if errors.Cause(err) == ErrInvalidAuthorization {
err = errors.Wrapf(err, "pull access denied, repository does not exist or may require authorization")
}
return "", ocispec.Descriptor{}, err return "", ocispec.Descriptor{}, err
} }
resp.Body.Close() // don't care about body contents. resp.Body.Close() // don't care about body contents.