summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/libpod/networks.go
diff options
context:
space:
mode:
authorzhangguanzhang <zhangguanzhang@qq.com>2020-08-02 21:08:13 +0800
committerValentin Rothberg <rothberg@redhat.com>2020-08-11 13:53:23 +0200
commit8931e99a18cc168ebee07bb72b62849815af7434 (patch)
tree9ed8bf6344ae3c6e3d629f94b868997c34398bb3 /pkg/api/handlers/libpod/networks.go
parentc24c64e89e8a32b4fa24385aa540ee00f5d0c991 (diff)
downloadpodman-8931e99a18cc168ebee07bb72b62849815af7434.tar.gz
podman-8931e99a18cc168ebee07bb72b62849815af7434.tar.bz2
podman-8931e99a18cc168ebee07bb72b62849815af7434.zip
API returns 500 in case network is not found instead of 404
Backported-by: Valentin Rothberg <rothberg@redhat.com> Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
Diffstat (limited to 'pkg/api/handlers/libpod/networks.go')
-rw-r--r--pkg/api/handlers/libpod/networks.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/pkg/api/handlers/libpod/networks.go b/pkg/api/handlers/libpod/networks.go
index 12409bf50..0164d5d13 100644
--- a/pkg/api/handlers/libpod/networks.go
+++ b/pkg/api/handlers/libpod/networks.go
@@ -5,10 +5,10 @@ import (
"net/http"
"github.com/containers/libpod/v2/libpod"
+ "github.com/containers/libpod/v2/libpod/define"
"github.com/containers/libpod/v2/pkg/api/handlers/utils"
"github.com/containers/libpod/v2/pkg/domain/entities"
"github.com/containers/libpod/v2/pkg/domain/infra/abi"
- "github.com/containers/libpod/v2/pkg/network"
"github.com/gorilla/schema"
"github.com/pkg/errors"
)
@@ -78,7 +78,7 @@ func RemoveNetwork(w http.ResponseWriter, r *http.Request) {
}
if reports[0].Err != nil {
// If the network cannot be found, we return a 404.
- if errors.Cause(err) == network.ErrNetworkNotFound {
+ if errors.Cause(err) == define.ErrNoSuchNetwork {
utils.Error(w, "Something went wrong", http.StatusNotFound, err)
return
}
@@ -104,7 +104,7 @@ func InspectNetwork(w http.ResponseWriter, r *http.Request) {
reports, err := ic.NetworkInspect(r.Context(), []string{name}, options)
if err != nil {
// If the network cannot be found, we return a 404.
- if errors.Cause(err) == network.ErrNetworkNotFound {
+ if errors.Cause(err) == define.ErrNoSuchNetwork {
utils.Error(w, "Something went wrong", http.StatusNotFound, err)
return
}