summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/utils
diff options
context:
space:
mode:
authorzhangguanzhang <zhangguanzhang@qq.com>2020-08-02 21:08:13 +0800
committerzhangguanzhang <zhangguanzhang@qq.com>2020-08-02 22:21:28 +0800
commit45b100d21ce1ca1843e26366466d09eac2d4add0 (patch)
treea4fbcccc680ba028deacedb9039e8f1de07e5316 /pkg/api/handlers/utils
parentf4d4bd22887e1271c3bf04532596f4c02201022e (diff)
downloadpodman-45b100d21ce1ca1843e26366466d09eac2d4add0.tar.gz
podman-45b100d21ce1ca1843e26366466d09eac2d4add0.tar.bz2
podman-45b100d21ce1ca1843e26366466d09eac2d4add0.zip
API returns 500 in case network is not found instead of 404
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
Diffstat (limited to 'pkg/api/handlers/utils')
-rw-r--r--pkg/api/handlers/utils/errors.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/api/handlers/utils/errors.go b/pkg/api/handlers/utils/errors.go
index 5a99529c6..bf9b18960 100644
--- a/pkg/api/handlers/utils/errors.go
+++ b/pkg/api/handlers/utils/errors.go
@@ -39,6 +39,7 @@ func VolumeNotFound(w http.ResponseWriter, name string, err error) {
msg := fmt.Sprintf("No such volume: %s", name)
Error(w, msg, http.StatusNotFound, err)
}
+
func ContainerNotFound(w http.ResponseWriter, name string, err error) {
if errors.Cause(err) != define.ErrNoSuchCtr {
InternalServerError(w, err)
@@ -55,6 +56,14 @@ func ImageNotFound(w http.ResponseWriter, name string, err error) {
Error(w, msg, http.StatusNotFound, err)
}
+func NetworkNotFound(w http.ResponseWriter, name string, err error) {
+ if errors.Cause(err) != define.ErrNoSuchNetwork {
+ InternalServerError(w, err)
+ }
+ msg := fmt.Sprintf("No such network: %s", name)
+ Error(w, msg, http.StatusNotFound, err)
+}
+
func PodNotFound(w http.ResponseWriter, name string, err error) {
if errors.Cause(err) != define.ErrNoSuchPod {
InternalServerError(w, err)