mirror of https://github.com/docker/cli.git
client: don't hide context errors
Instead of reformatting error from the request action, we wrap it, allowing the cause to be recovered. This is important for consumers that need to be able to detect context errors, such as `Cancelled` and `DeadlineExceeded`. Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
parent
d675c81577
commit
450b3123e3
|
@ -14,6 +14,7 @@ import (
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/api/types/versions"
|
"github.com/docker/docker/api/types/versions"
|
||||||
"github.com/docker/docker/client/transport/cancellable"
|
"github.com/docker/docker/client/transport/cancellable"
|
||||||
|
"github.com/pkg/errors"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -131,7 +132,8 @@ func (cli *Client) sendClientRequest(ctx context.Context, method, path string, q
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return serverResp, fmt.Errorf("An error occurred trying to connect: %v", err)
|
|
||||||
|
return serverResp, errors.Wrap(err, "error during connect")
|
||||||
}
|
}
|
||||||
|
|
||||||
if resp != nil {
|
if resp != nil {
|
||||||
|
|
Loading…
Reference in New Issue