diff options
author | openshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com> | 2022-07-05 07:23:22 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-05 07:23:22 +0000 |
commit | 773eead54e2e0877e92d5871625a6cc32c582d30 (patch) | |
tree | 9463bca52c2c0a9db27c9dd5052fa78c0b27a22a /libpod/runtime_pod.go | |
parent | 3e7e66edad1269420cb45bcabbd93ac4d0e1b585 (diff) | |
parent | 597de7a083c329bdaed7fc469555a4142f71bcb8 (diff) | |
download | podman-773eead54e2e0877e92d5871625a6cc32c582d30.tar.gz podman-773eead54e2e0877e92d5871625a6cc32c582d30.tar.bz2 podman-773eead54e2e0877e92d5871625a6cc32c582d30.zip |
Merge pull request #14789 from saschagrunert/libpod-errors
libpod/runtime: switch to golang native error wrapping
Diffstat (limited to 'libpod/runtime_pod.go')
-rw-r--r-- | libpod/runtime_pod.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libpod/runtime_pod.go b/libpod/runtime_pod.go index ee3d40484..25e48de14 100644 --- a/libpod/runtime_pod.go +++ b/libpod/runtime_pod.go @@ -2,11 +2,12 @@ package libpod import ( "context" + "errors" + "fmt" "time" "github.com/containers/common/pkg/util" "github.com/containers/podman/v4/libpod/define" - "github.com/pkg/errors" ) // Contains the public Runtime API for pods @@ -112,7 +113,7 @@ func (r *Runtime) GetLatestPod() (*Pod, error) { var lastCreatedTime time.Time pods, err := r.GetAllPods() if err != nil { - return nil, errors.Wrapf(err, "unable to get all pods") + return nil, fmt.Errorf("unable to get all pods: %w", err) } if len(pods) == 0 { return nil, define.ErrNoSuchPod @@ -146,7 +147,7 @@ func (r *Runtime) GetRunningPods() ([]*Pod, error) { pods = append(pods, c.PodID()) pod, err := r.GetPod(c.PodID()) if err != nil { - if errors.Cause(err) == define.ErrPodRemoved || errors.Cause(err) == define.ErrNoSuchPod { + if errors.Is(err, define.ErrPodRemoved) || errors.Is(err, define.ErrNoSuchPod) { continue } return nil, err |