summaryrefslogtreecommitdiff
path: root/registry/service.go
diff options
context:
space:
mode:
authorSebastiaan van Stijn <github@gone.nl>2022-02-26 13:45:12 +0100
committerSebastiaan van Stijn <github@gone.nl>2022-03-17 17:12:13 +0100
commit79aa65c1faa5ddd924ccebf377db64f049459afc (patch)
tree8607a96cded421f8b6bf093050844fed28991ea2 /registry/service.go
parent98202c86adb4ee697bb2ff5c6d72ab373ab2a0f6 (diff)
downloaddocker-79aa65c1faa5ddd924ccebf377db64f049459afc.tar.gz
registry: return "errdefs" compatible error types
Adding some small utility functions to make generating them easier. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Diffstat (limited to 'registry/service.go')
-rw-r--r--registry/service.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/registry/service.go b/registry/service.go
index ea2fb35c14..b5e24ebac8 100644
--- a/registry/service.go
+++ b/registry/service.go
@@ -13,7 +13,6 @@ import (
"github.com/docker/docker/api/types"
registrytypes "github.com/docker/docker/api/types/registry"
"github.com/docker/docker/errdefs"
- "github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
@@ -117,7 +116,7 @@ func (s *defaultService) Auth(ctx context.Context, authConfig *types.AuthConfig,
}
u, err := url.Parse(serverAddress)
if err != nil {
- return "", "", errdefs.InvalidParameter(errors.Errorf("unable to parse server address: %v", err))
+ return "", "", invalidParamWrapf(err, "unable to parse server address")
}
registryHostName = u.Host
}
@@ -127,7 +126,7 @@ func (s *defaultService) Auth(ctx context.Context, authConfig *types.AuthConfig,
// to a mirror.
endpoints, err := s.LookupPushEndpoints(registryHostName)
if err != nil {
- return "", "", errdefs.InvalidParameter(err)
+ return "", "", invalidParam(err)
}
for _, endpoint := range endpoints {
@@ -162,7 +161,7 @@ func splitReposSearchTerm(reposName string) (string, string) {
func (s *defaultService) Search(ctx context.Context, term string, limit int, authConfig *types.AuthConfig, userAgent string, headers map[string][]string) (*registrytypes.SearchResults, error) {
// TODO Use ctx when searching for repositories
if hasScheme(term) {
- return nil, errors.New(`invalid repository name (ex: "registry.domain.tld/myrepos")`)
+ return nil, invalidParamf("invalid repository name: repository name (%s) should not have a scheme", term)
}
indexName, remoteName := splitReposSearchTerm(term)