diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-01-22 17:43:57 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-22 17:43:57 -0500 |
commit | ac3a6b80b0ccd2f9592110811ccf6fd844110b9e (patch) | |
tree | 5f788ecb4b9a1f412c7b7ae0d61bdf0a6765b513 /pkg/api/handlers/utils/errors.go | |
parent | 8b377a79c240e4480339358db3b87263ec6cfef3 (diff) | |
parent | da1186ae639c8101f05e4350986fdab0b1bd3566 (diff) | |
download | podman-ac3a6b80b0ccd2f9592110811ccf6fd844110b9e.tar.gz podman-ac3a6b80b0ccd2f9592110811ccf6fd844110b9e.tar.bz2 podman-ac3a6b80b0ccd2f9592110811ccf6fd844110b9e.zip |
Merge pull request #4936 from jwhonce/wip/swagger2
[CI:DOCS] Enable swagger validation for each PR
Diffstat (limited to 'pkg/api/handlers/utils/errors.go')
-rw-r--r-- | pkg/api/handlers/utils/errors.go | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/pkg/api/handlers/utils/errors.go b/pkg/api/handlers/utils/errors.go index b6f125c58..9d2081cd8 100644 --- a/pkg/api/handlers/utils/errors.go +++ b/pkg/api/handlers/utils/errors.go @@ -27,34 +27,34 @@ func Error(w http.ResponseWriter, apiMessage string, code int, err error) { WriteJSON(w, code, em) } -func VolumeNotFound(w http.ResponseWriter, nameOrId string, err error) { +func VolumeNotFound(w http.ResponseWriter, name string, err error) { if errors.Cause(err) != define.ErrNoSuchVolume { InternalServerError(w, err) } - msg := fmt.Sprintf("No such volume: %s", nameOrId) + msg := fmt.Sprintf("No such volume: %s", name) Error(w, msg, http.StatusNotFound, err) } -func ContainerNotFound(w http.ResponseWriter, nameOrId string, err error) { +func ContainerNotFound(w http.ResponseWriter, name string, err error) { if errors.Cause(err) != define.ErrNoSuchCtr { InternalServerError(w, err) } - msg := fmt.Sprintf("No such container: %s", nameOrId) + msg := fmt.Sprintf("No such container: %s", name) Error(w, msg, http.StatusNotFound, err) } -func ImageNotFound(w http.ResponseWriter, nameOrId string, err error) { +func ImageNotFound(w http.ResponseWriter, name string, err error) { if errors.Cause(err) != define.ErrNoSuchImage { InternalServerError(w, err) } - msg := fmt.Sprintf("No such image: %s", nameOrId) + msg := fmt.Sprintf("No such image: %s", name) Error(w, msg, http.StatusNotFound, err) } -func PodNotFound(w http.ResponseWriter, nameOrId string, err error) { +func PodNotFound(w http.ResponseWriter, name string, err error) { if errors.Cause(err) != define.ErrNoSuchPod { InternalServerError(w, err) } - msg := fmt.Sprintf("No such pod: %s", nameOrId) + msg := fmt.Sprintf("No such pod: %s", name) Error(w, msg, http.StatusNotFound, err) } @@ -73,9 +73,11 @@ func BadRequest(w http.ResponseWriter, key string, value string, err error) { } type ErrorModel struct { - // root cause + // API root cause formatted for automated parsing + // example: API root cause Because string `json:"cause"` - // error message + // human error message, formatted for a human to read + // example: human error message Message string `json:"message"` } |