cli/registry/client: un-export ErrHTTPProto

This type was added in 02719bdbb5fb47389e47575bb006509da86df344, but was
never used outside of the package itself. This patch un-exports it.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2025-03-03 15:32:58 +01:00
parent 293bbb44a0
commit 1a165fd535
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
2 changed files with 8 additions and 7 deletions

View File

@ -54,13 +54,13 @@ func (err ErrBlobCreated) Error() string {
err.From, err.Target) err.From, err.Target)
} }
// ErrHTTPProto returned if attempting to use TLS with a non-TLS registry // httpProtoError returned if attempting to use TLS with a non-TLS registry
type ErrHTTPProto struct { type httpProtoError struct {
OrigErr string cause error
} }
func (err ErrHTTPProto) Error() string { func (e httpProtoError) Error() string {
return err.OrigErr return e.cause.Error()
} }
var _ RegistryClient = &client{} var _ RegistryClient = &client{}
@ -131,7 +131,7 @@ func (c *client) getRepositoryForReference(ctx context.Context, ref reference.Na
return nil, err return nil, err
} }
if !repoEndpoint.endpoint.TLSConfig.InsecureSkipVerify { if !repoEndpoint.endpoint.TLSConfig.InsecureSkipVerify {
return nil, ErrHTTPProto{OrigErr: err.Error()} return nil, httpProtoError{cause: err}
} }
// --insecure was set; fall back to plain HTTP // --insecure was set; fall back to plain HTTP
if url := repoEndpoint.endpoint.URL; url != nil && url.Scheme == "https" { if url := repoEndpoint.endpoint.URL; url != nil && url.Scheme == "https" {

View File

@ -241,7 +241,8 @@ func (c *client) iterateEndpoints(ctx context.Context, namedRef reference.Named,
repo, err := c.getRepositoryForReference(ctx, namedRef, repoEndpoint) repo, err := c.getRepositoryForReference(ctx, namedRef, repoEndpoint)
if err != nil { if err != nil {
logrus.Debugf("error %s with repo endpoint %+v", err, repoEndpoint) logrus.Debugf("error %s with repo endpoint %+v", err, repoEndpoint)
if _, ok := err.(ErrHTTPProto); ok { var protoErr httpProtoError
if errors.As(err, &protoErr) {
continue continue
} }
return err return err