include image name in errors
The go docker client's ErrNoSuchImage does not include the image name. However, it is imperative that this name appears in error messages sent to clients, since the docker client, as of version 1.7.0, only automatically pulls images when their name is present in the error. Fixes #967.
This commit is contained in:
1 parent
b7281cc08d
commit
3732f968d0
2 files changed
+17
-5
No files matched your search
@@ -16,11 +16,10 @@ import (
|
||||
|
||||
func (proxy *Proxy) Intercept(i interceptor, w http.ResponseWriter, r *http.Request) {
|
||||
if err := i.InterceptRequest(r); err != nil {
|
||||
_, isNoSuchContainer := err.(*docker.NoSuchContainer)
|
||||
switch {
|
||||
case isNoSuchContainer:
|
||||
switch err.(type) {
|
||||
case *docker.NoSuchContainer:
|
||||
http.Error(w, err.Error(), http.StatusNotFound)
|
||||
case err == docker.ErrNoSuchImage:
|
||||
case *ErrNoSuchImage:
|
||||
http.Error(w, err.Error(), http.StatusNotFound)
|
||||
default:
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
|
||||
Reference in new issue
Block a user