summaryrefslogtreecommitdiff
path: root/pkg/domain/infra
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-09-08 16:57:23 +0200
committerGitHub <noreply@github.com>2021-09-08 16:57:23 +0200
commitd68e429859b497cd31c6e3dfdc64dce58b0b95d5 (patch)
tree9863df8094c55035ae4ad061f9ea307d14149edf /pkg/domain/infra
parent558ba1b99ec5af32e0e92934dc87c7461a975469 (diff)
parent6aa666a27c1e670b4df6f3fe477c0a55255c0aae (diff)
downloadpodman-d68e429859b497cd31c6e3dfdc64dce58b0b95d5.tar.gz
podman-d68e429859b497cd31c6e3dfdc64dce58b0b95d5.tar.bz2
podman-d68e429859b497cd31c6e3dfdc64dce58b0b95d5.zip
Merge pull request #11476 from vrothberg/fix-11392
container inspect: improve error handling
Diffstat (limited to 'pkg/domain/infra')
-rw-r--r--pkg/domain/infra/abi/containers.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go
index ff34ec86b..dc5f7a0df 100644
--- a/pkg/domain/infra/abi/containers.go
+++ b/pkg/domain/infra/abi/containers.go
@@ -371,7 +371,7 @@ func (ic *ContainerEngine) ContainerInspect(ctx context.Context, namesOrIds []st
if options.Latest {
ctr, err := ic.Libpod.GetLatestContainer()
if err != nil {
- if errors.Cause(err) == define.ErrNoSuchCtr {
+ if errors.Is(err, define.ErrNoSuchCtr) {
return nil, []error{errors.Wrapf(err, "no containers to inspect")}, nil
}
return nil, nil, err
@@ -397,7 +397,7 @@ func (ic *ContainerEngine) ContainerInspect(ctx context.Context, namesOrIds []st
if err != nil {
// ErrNoSuchCtr is non-fatal, other errors will be
// treated as fatal.
- if errors.Cause(err) == define.ErrNoSuchCtr {
+ if errors.Is(err, define.ErrNoSuchCtr) {
errs = append(errs, errors.Errorf("no such container %s", name))
continue
}
@@ -406,6 +406,12 @@ func (ic *ContainerEngine) ContainerInspect(ctx context.Context, namesOrIds []st
inspect, err := ctr.Inspect(options.Size)
if err != nil {
+ // ErrNoSuchCtr is non-fatal, other errors will be
+ // treated as fatal.
+ if errors.Is(err, define.ErrNoSuchCtr) {
+ errs = append(errs, errors.Errorf("no such container %s", name))
+ continue
+ }
return nil, nil, err
}