diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-01-24 13:14:44 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-24 13:14:44 -0500 |
commit | 54bfabb78a09bc50f270a81756a303e49965f253 (patch) | |
tree | 12fad22a19318dd8ba1ca583cac2b7ba587cff83 /pkg/api/handlers/compat/volumes.go | |
parent | b75d6baf074a61f2119b8619c86bd2fae1cb2833 (diff) | |
parent | 7938f32c532557eff69ada6a29b46906c3e691a3 (diff) | |
download | podman-54bfabb78a09bc50f270a81756a303e49965f253.tar.gz podman-54bfabb78a09bc50f270a81756a303e49965f253.tar.bz2 podman-54bfabb78a09bc50f270a81756a303e49965f253.zip |
Merge pull request #12973 from jmguzik/api-unused-param
Remove unused param from utils.Error in pkg/api and clean API handlers
Diffstat (limited to 'pkg/api/handlers/compat/volumes.go')
-rw-r--r-- | pkg/api/handlers/compat/volumes.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/pkg/api/handlers/compat/volumes.go b/pkg/api/handlers/compat/volumes.go index 352b5c7c3..c8e4339b0 100644 --- a/pkg/api/handlers/compat/volumes.go +++ b/pkg/api/handlers/compat/volumes.go @@ -26,7 +26,7 @@ func ListVolumes(w http.ResponseWriter, r *http.Request) { filtersMap, err := util.PrepareFilters(r) if err != nil { - utils.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError, + utils.Error(w, http.StatusInternalServerError, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String())) return } @@ -35,7 +35,7 @@ func ListVolumes(w http.ResponseWriter, r *http.Request) { // happily parse them for us. for filter := range *filtersMap { if filter == "opts" { - utils.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError, + utils.Error(w, http.StatusInternalServerError, errors.Errorf("unsupported libpod filters passed to docker endpoint")) return } @@ -85,14 +85,14 @@ func CreateVolume(w http.ResponseWriter, r *http.Request) { /* No query string data*/ query := struct{}{} if err := decoder.Decode(&query, r.URL.Query()); err != nil { - utils.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError, + utils.Error(w, http.StatusInternalServerError, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String())) return } // decode params from body input := docker_api_types_volume.VolumeCreateBody{} if err := json.NewDecoder(r.Body).Decode(&input); err != nil { - utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "Decode()")) + utils.Error(w, http.StatusInternalServerError, errors.Wrap(err, "Decode()")) return } @@ -220,7 +220,7 @@ func RemoveVolume(w http.ResponseWriter, r *http.Request) { } if err := decoder.Decode(&query, r.URL.Query()); err != nil { - utils.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError, + utils.Error(w, http.StatusInternalServerError, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String())) return } @@ -242,7 +242,7 @@ func RemoveVolume(w http.ResponseWriter, r *http.Request) { // As above, we do not pass `force` from the query parameters here if err := runtime.RemoveVolume(r.Context(), vol, false, query.Timeout); err != nil { if errors.Cause(err) == define.ErrVolumeBeingUsed { - utils.Error(w, "volumes being used", http.StatusConflict, err) + utils.Error(w, http.StatusConflict, err) } else { utils.InternalServerError(w, err) } @@ -268,14 +268,14 @@ func PruneVolumes(w http.ResponseWriter, r *http.Request) { ) filterMap, err := util.PrepareFilters(r) if err != nil { - utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrap(err, "Decode()")) + utils.Error(w, http.StatusInternalServerError, errors.Wrap(err, "Decode()")) return } f := (url.Values)(*filterMap) filterFuncs, err := filters.GeneratePruneVolumeFilters(f) if err != nil { - utils.Error(w, "Something when wrong.", http.StatusInternalServerError, errors.Wrapf(err, "failed to parse filters for %s", f.Encode())) + utils.Error(w, http.StatusInternalServerError, errors.Wrapf(err, "failed to parse filters for %s", f.Encode())) return } |