mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #26797 from srodman7689/friendly_error_on_permissions_connection_error
Closes #26761 Updated the client/request.go sendClientRequest method to return a Pe…
This commit is contained in:
commit
16a45dba89
1 changed files with 9 additions and 0 deletions
|
@ -9,6 +9,7 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
@ -129,6 +130,14 @@ func (cli *Client) sendClientRequest(ctx context.Context, method, path string, q
|
||||||
return serverResp, err
|
return serverResp, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if nErr, ok := err.(*url.Error); ok {
|
||||||
|
if nErr, ok := nErr.Err.(*net.OpError); ok {
|
||||||
|
if os.IsPermission(nErr.Err) {
|
||||||
|
return serverResp, errors.Wrapf(err, "Got permission denied while trying to connect to the Docker daemon socket at %v", cli.host)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if err, ok := err.(net.Error); ok {
|
if err, ok := err.(net.Error); ok {
|
||||||
if err.Timeout() {
|
if err.Timeout() {
|
||||||
return serverResp, ErrorConnectionFailed(cli.host)
|
return serverResp, ErrorConnectionFailed(cli.host)
|
||||||
|
|
Loading…
Reference in a new issue