summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/utils
diff options
context:
space:
mode:
authorSascha Grunert <sgrunert@redhat.com>2022-07-06 09:48:36 +0200
committerSascha Grunert <sgrunert@redhat.com>2022-07-08 08:54:47 +0200
commita46f798831df06c472b288db7b34de8536a7ea5a (patch)
treec370fb0fc23b461691906e308b179a50e583228b /pkg/api/handlers/utils
parent862cc42ddc11ff56b41be128182b748b0843dff3 (diff)
downloadpodman-a46f798831df06c472b288db7b34de8536a7ea5a.tar.gz
podman-a46f798831df06c472b288db7b34de8536a7ea5a.tar.bz2
podman-a46f798831df06c472b288db7b34de8536a7ea5a.zip
pkg: switch to golang native error wrapping
We now use the golang error wrapping format specifier `%w` instead of the deprecated github.com/pkg/errors package. [NO NEW TESTS NEEDED] Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
Diffstat (limited to 'pkg/api/handlers/utils')
-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