aboutsummaryrefslogtreecommitdiff
path: root/pkg/api/handlers/utils/handler.go
diff options
context:
space:
mode:
authoropenshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com>2022-07-08 09:24:25 +0000
committerGitHub <noreply@github.com>2022-07-08 09:24:25 +0000
commit6087fb2116aaeae995e8423872ffe637e8be128f (patch)
treee8bd00a9b325a51a49de02e868f06eec2deeb529 /pkg/api/handlers/utils/handler.go
parenta2bcf833c98cb38eb28dc65a8768963d0b7344fc (diff)
parenta46f798831df06c472b288db7b34de8536a7ea5a (diff)
downloadpodman-6087fb2116aaeae995e8423872ffe637e8be128f.tar.gz
podman-6087fb2116aaeae995e8423872ffe637e8be128f.tar.bz2
podman-6087fb2116aaeae995e8423872ffe637e8be128f.zip
Merge pull request #14839 from saschagrunert/errors-pkg
pkg: switch to golang native error wrapping
Diffstat (limited to 'pkg/api/handlers/utils/handler.go')
-rw-r--r--pkg/api/handlers/utils/handler.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/api/handlers/utils/handler.go b/pkg/api/handlers/utils/handler.go
index 338d5a84b..9562ebbbc 100644
--- a/pkg/api/handlers/utils/handler.go
+++ b/pkg/api/handlers/utils/handler.go
@@ -1,6 +1,7 @@
package utils
import (
+ "errors"
"fmt"
"io"
"net/http"
@@ -13,7 +14,6 @@ import (
"github.com/containers/podman/v4/version"
"github.com/gorilla/mux"
jsoniter "github.com/json-iterator/go"
- "github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
@@ -42,11 +42,11 @@ func SupportedVersion(r *http.Request, condition string) (semver.Version, error)
}
safeVal, err := url.PathUnescape(val)
if err != nil {
- return version, errors.Wrapf(err, "unable to unescape given API version: %q", val)
+ return version, fmt.Errorf("unable to unescape given API version: %q: %w", val, err)
}
version, err = semver.ParseTolerant(safeVal)
if err != nil {
- return version, errors.Wrapf(err, "unable to parse given API version: %q from %q", safeVal, val)
+ return version, fmt.Errorf("unable to parse given API version: %q from %q: %w", safeVal, val, err)
}
inRange, err := semver.ParseRange(condition)
@@ -178,7 +178,7 @@ func GetVar(r *http.Request, k string) string {
val := mux.Vars(r)[k]
safeVal, err := url.PathUnescape(val)
if err != nil {
- logrus.Error(errors.Wrapf(err, "failed to unescape mux key %s, value %s", k, val))
+ logrus.Error(fmt.Errorf("failed to unescape mux key %s, value %s: %w", k, val, err))
return val
}
return safeVal