summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/utils/errors.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-08-03 09:13:40 -0400
committerGitHub <noreply@github.com>2020-08-03 09:13:40 -0400
commit96ece0ca56fca249bcf84061de0e944f3c092ea5 (patch)
treec6f1f28ae3481f6b617f5931da9d91f323de556d /pkg/api/handlers/utils/errors.go
parentde5eb3831190262169eab36e64c41992dc22766a (diff)
parent45b100d21ce1ca1843e26366466d09eac2d4add0 (diff)
downloadpodman-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/utils/errors.go')
-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)