diff --git a/pkg/api/handlers/utils/errors.go b/pkg/api/handlers/utils/errors.go index 919a8df1e6..bf60b2c844 100644 --- a/pkg/api/handlers/utils/errors.go +++ b/pkg/api/handlers/utils/errors.go @@ -40,10 +40,12 @@ func VolumeNotFound(w http.ResponseWriter, name string, err error) { } func ContainerNotFound(w http.ResponseWriter, name string, err error) { - if errors.Cause(err) != define.ErrNoSuchCtr { + switch errors.Cause(err) { + case define.ErrNoSuchCtr, define.ErrCtrExists: + Error(w, http.StatusNotFound, err) + default: InternalServerError(w, err) } - Error(w, http.StatusNotFound, err) } func ImageNotFound(w http.ResponseWriter, name string, err error) {