diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-08-03 09:13:40 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-03 09:13:40 -0400 |
commit | 96ece0ca56fca249bcf84061de0e944f3c092ea5 (patch) | |
tree | c6f1f28ae3481f6b617f5931da9d91f323de556d /pkg/api/handlers/libpod | |
parent | de5eb3831190262169eab36e64c41992dc22766a (diff) | |
parent | 45b100d21ce1ca1843e26366466d09eac2d4add0 (diff) | |
download | podman-96ece0ca56fca249bcf84061de0e944f3c092ea5.tar.gz podman-96ece0ca56fca249bcf84061de0e944f3c092ea5.tar.bz2 podman-96ece0ca56fca249bcf84061de0e944f3c092ea5.zip |
Merge pull request #7188 from zhangguanzhang/network-404
API returns 500 in case network is not found instead of 404
Diffstat (limited to 'pkg/api/handlers/libpod')
-rw-r--r-- | pkg/api/handlers/libpod/networks.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pkg/api/handlers/libpod/networks.go b/pkg/api/handlers/libpod/networks.go index 9237a41ce..475522664 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/podman/v2/libpod" + "github.com/containers/podman/v2/libpod/define" "github.com/containers/podman/v2/pkg/api/handlers/utils" "github.com/containers/podman/v2/pkg/domain/entities" "github.com/containers/podman/v2/pkg/domain/infra/abi" - "github.com/containers/podman/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 } |