Skip to content

Commit 1a165fd

Browse files
committed
cli/registry/client: un-export ErrHTTPProto
This type was added in 02719bd, but was never used outside of the package itself. This patch un-exports it. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 293bbb4 commit 1a165fd

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

cli/registry/client/client.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ func (err ErrBlobCreated) Error() string {
5454
err.From, err.Target)
5555
}
5656

57-
// ErrHTTPProto returned if attempting to use TLS with a non-TLS registry
58-
type ErrHTTPProto struct {
59-
OrigErr string
57+
// httpProtoError returned if attempting to use TLS with a non-TLS registry
58+
type httpProtoError struct {
59+
cause error
6060
}
6161

62-
func (err ErrHTTPProto) Error() string {
63-
return err.OrigErr
62+
func (e httpProtoError) Error() string {
63+
return e.cause.Error()
6464
}
6565

6666
var _ RegistryClient = &client{}
@@ -131,7 +131,7 @@ func (c *client) getRepositoryForReference(ctx context.Context, ref reference.Na
131131
return nil, err
132132
}
133133
if !repoEndpoint.endpoint.TLSConfig.InsecureSkipVerify {
134-
return nil, ErrHTTPProto{OrigErr: err.Error()}
134+
return nil, httpProtoError{cause: err}
135135
}
136136
// --insecure was set; fall back to plain HTTP
137137
if url := repoEndpoint.endpoint.URL; url != nil && url.Scheme == "https" {

cli/registry/client/fetcher.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ func (c *client) iterateEndpoints(ctx context.Context, namedRef reference.Named,
241241
repo, err := c.getRepositoryForReference(ctx, namedRef, repoEndpoint)
242242
if err != nil {
243243
logrus.Debugf("error %s with repo endpoint %+v", err, repoEndpoint)
244-
if _, ok := err.(ErrHTTPProto); ok {
244+
var protoErr httpProtoError
245+
if errors.As(err, &protoErr) {
245246
continue
246247
}
247248
return err

0 commit comments

Comments
 (0)