Returning and handling error from HTTPClientAndScheme

Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
This commit is contained in:
Nishant Totla
2016-04-08 12:02:16 -07:00
parent 42fc136b39
commit 1dee9cb3f0
3 changed files with 14 additions and 10 deletions

View File

@@ -484,9 +484,9 @@ func getContainerJSON(c *context, w http.ResponseWriter, r *http.Request) {
return
}
client, scheme := container.Engine.HTTPClientAndScheme()
if client == nil {
httpError(w, "Cannot connect to docker engine", http.StatusInternalServerError)
client, scheme, err := container.Engine.HTTPClientAndScheme()
if err != nil {
httpError(w, err.Error(), http.StatusInternalServerError)
return
}
@@ -814,9 +814,9 @@ func postContainersExec(c *context, w http.ResponseWriter, r *http.Request) {
return
}
client, scheme := container.Engine.HTTPClientAndScheme()
if client == nil {
httpError(w, "Cannot connect to docker engine", http.StatusInternalServerError)
client, scheme, err := container.Engine.HTTPClientAndScheme()
if err != nil {
httpError(w, err.Error(), http.StatusInternalServerError)
return
}

View File

@@ -93,7 +93,11 @@ func proxyAsync(engine *cluster.Engine, w http.ResponseWriter, r *http.Request,
// RequestURI may not be sent to client
r.RequestURI = ""
client, scheme := engine.HTTPClientAndScheme()
client, scheme, err := engine.HTTPClientAndScheme()
if err != nil {
return err
}
r.URL.Scheme = scheme
r.URL.Host = engine.Addr