diff options
author | Sebastiaan van Stijn <github@gone.nl> | 2019-02-09 19:19:22 +0100 |
---|---|---|
committer | Sebastiaan van Stijn <github@gone.nl> | 2019-03-16 00:42:42 +0100 |
commit | 0cafc84fb21f675a9794c80e59f8f85919c618ec (patch) | |
tree | 94950bee3ddf1d842e9928d9a9771b8502986839 /client/image_search.go | |
parent | 053c6f097a1af7047e831094c0dfa3408a2c9d2b (diff) | |
download | docker-0cafc84fb21f675a9794c80e59f8f85919c618ec.tar.gz |
Use errdefs for handling errors in client
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Diffstat (limited to 'client/image_search.go')
-rw-r--r-- | client/image_search.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/client/image_search.go b/client/image_search.go index 176de3c582..bbdf9e153e 100644 --- a/client/image_search.go +++ b/client/image_search.go @@ -4,12 +4,12 @@ import ( "context" "encoding/json" "fmt" - "net/http" "net/url" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/registry" + "github.com/docker/docker/errdefs" ) // ImageSearch makes the docker host to search by a term in a remote registry. @@ -29,7 +29,7 @@ func (cli *Client) ImageSearch(ctx context.Context, term string, options types.I } resp, err := cli.tryImageSearch(ctx, query, options.RegistryAuth) - if resp.statusCode == http.StatusUnauthorized && options.PrivilegeFunc != nil { + if errdefs.IsUnauthorized(err) && options.PrivilegeFunc != nil { newAuthHeader, privilegeErr := options.PrivilegeFunc() if privilegeErr != nil { return results, privilegeErr |