proxy should provide reasonable error when execing on a container which doesn't exist
This commit is contained in:
1 parent
e6b587ea8d
commit
610bc46970
1 file changed
+11
-8
+11
-8
@@ -27,14 +27,17 @@ func newClient(dial func() (net.Conn, error), i interceptor) *client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *client) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
func (c *client) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
err := c.InterceptRequest(r)
|
if err := c.InterceptRequest(r); err != nil {
|
||||||
if err == docker.ErrNoSuchImage {
|
_, isNoSuchContainer := err.(*docker.NoSuchContainer)
|
||||||
http.NotFound(w, r)
|
switch {
|
||||||
return
|
case isNoSuchContainer:
|
||||||
}
|
http.Error(w, err.Error(), http.StatusNotFound)
|
||||||
if err != nil {
|
case err == docker.ErrNoSuchImage:
|
||||||
http.Error(w, "Unable to intercept request", http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusNotFound)
|
||||||
Warning.Print("Error intercepting request: ", err)
|
default:
|
||||||
|
http.Error(w, "Unable to intercept request", http.StatusInternalServerError)
|
||||||
|
Warning.Print("Error intercepting request: ", err)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user