summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/libpod/containers_stats.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/api/handlers/libpod/containers_stats.go')
-rw-r--r--pkg/api/handlers/libpod/containers_stats.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/api/handlers/libpod/containers_stats.go b/pkg/api/handlers/libpod/containers_stats.go
index 46d722a3d..687d61c12 100644
--- a/pkg/api/handlers/libpod/containers_stats.go
+++ b/pkg/api/handlers/libpod/containers_stats.go
@@ -2,6 +2,8 @@ package libpod
import (
"encoding/json"
+ "errors"
+ "fmt"
"net/http"
"github.com/containers/common/pkg/cgroups"
@@ -12,7 +14,6 @@ import (
"github.com/containers/podman/v4/pkg/domain/infra/abi"
"github.com/containers/podman/v4/pkg/rootless"
"github.com/gorilla/schema"
- "github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
@@ -24,8 +25,7 @@ func StatsContainer(w http.ResponseWriter, r *http.Request) {
if rootless.IsRootless() {
// if so, then verify cgroup v2 available (more expensive check)
if isV2, _ := cgroups.IsCgroup2UnifiedMode(); !isV2 {
- msg := "Container stats resource only available for cgroup v2"
- utils.Error(w, http.StatusConflict, errors.New(msg))
+ utils.Error(w, http.StatusConflict, errors.New("container stats resource only available for cgroup v2"))
return
}
}
@@ -39,7 +39,7 @@ func StatsContainer(w http.ResponseWriter, r *http.Request) {
Interval: 5,
}
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
- utils.Error(w, http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
+ utils.Error(w, http.StatusBadRequest, fmt.Errorf("failed to parse parameters for %s: %w", r.URL.String(), err))
return
}