Merge pull request #15370 from cpuguy83/better_error_on_client_connect

Better/more specific error messages on connect
This commit is contained in:
David Calavera 2015-08-07 13:00:44 -07:00
commit 134e4e9dc1

View file

@ -20,6 +20,7 @@ import (
"time" "time"
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/api/types"
"github.com/docker/docker/cliconfig" "github.com/docker/docker/cliconfig"
"github.com/docker/docker/pkg/httputils" "github.com/docker/docker/pkg/httputils"
"github.com/docker/docker/pkg/ioutils" "github.com/docker/docker/pkg/ioutils"
@ -424,7 +425,7 @@ func (r *Session) GetRepositoryData(remote string) (*RepositoryData, error) {
// and return a non-obtuse error message for users // and return a non-obtuse error message for users
// "Get https://index.docker.io/v1/repositories/library/busybox/images: i/o timeout" // "Get https://index.docker.io/v1/repositories/library/busybox/images: i/o timeout"
// was a top search on the docker user forum // was a top search on the docker user forum
if strings.HasSuffix(err.Error(), "i/o timeout") { if types.IsTimeout(err) {
return nil, fmt.Errorf("Network timed out while trying to connect to %s. You may want to check your internet connection or if you are behind a proxy.", repositoryTarget) return nil, fmt.Errorf("Network timed out while trying to connect to %s. You may want to check your internet connection or if you are behind a proxy.", repositoryTarget)
} }
return nil, fmt.Errorf("Error while pulling image: %v", err) return nil, fmt.Errorf("Error while pulling image: %v", err)