summaryrefslogtreecommitdiff
path: root/libpod/runtime_cstorage.go
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin@redhat.com>2019-10-14 13:49:06 -0400
committerNalin Dahyabhai <nalin@redhat.com>2019-10-14 13:49:06 -0400
commit17a7596af4f8e2898bd11945a5b3c085b882b021 (patch)
tree49bd3ac19c98fd1f018b7a12e738a0097f7cd0ce /libpod/runtime_cstorage.go
parent3e45d0730b4a17a91912eb161de30cb88e76bb33 (diff)
downloadpodman-17a7596af4f8e2898bd11945a5b3c085b882b021.tar.gz
podman-17a7596af4f8e2898bd11945a5b3c085b882b021.tar.bz2
podman-17a7596af4f8e2898bd11945a5b3c085b882b021.zip
Unwrap errors before comparing them
Unwrap errors before directly comparing them with errors defined by the storage and image libraries. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Diffstat (limited to 'libpod/runtime_cstorage.go')
-rw-r--r--libpod/runtime_cstorage.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/libpod/runtime_cstorage.go b/libpod/runtime_cstorage.go
index 47a91c881..2d523a7d2 100644
--- a/libpod/runtime_cstorage.go
+++ b/libpod/runtime_cstorage.go
@@ -68,7 +68,7 @@ func (r *Runtime) RemoveStorageContainer(idOrName string, force bool) error {
func (r *Runtime) removeStorageContainer(idOrName string, force bool) error {
targetID, err := r.store.Lookup(idOrName)
if err != nil {
- if err == storage.ErrLayerUnknown {
+ if errors.Cause(err) == storage.ErrLayerUnknown {
return errors.Wrapf(define.ErrNoSuchCtr, "no container with ID or name %q found", idOrName)
}
return errors.Wrapf(err, "error looking up container %q", idOrName)
@@ -78,7 +78,7 @@ func (r *Runtime) removeStorageContainer(idOrName string, force bool) error {
// So we can still error here.
ctr, err := r.store.Container(targetID)
if err != nil {
- if err == storage.ErrContainerUnknown {
+ if errors.Cause(err) == storage.ErrContainerUnknown {
return errors.Wrapf(define.ErrNoSuchCtr, "%q does not refer to a container", idOrName)
}
return errors.Wrapf(err, "error retrieving container %q", idOrName)
@@ -96,7 +96,7 @@ func (r *Runtime) removeStorageContainer(idOrName string, force bool) error {
if !force {
timesMounted, err := r.store.Mounted(ctr.ID)
if err != nil {
- if err == storage.ErrContainerUnknown {
+ if errors.Cause(err) == storage.ErrContainerUnknown {
// Container was removed from under us.
// It's gone, so don't bother erroring.
logrus.Warnf("Storage for container %s already removed", ctr.ID)
@@ -109,7 +109,7 @@ func (r *Runtime) removeStorageContainer(idOrName string, force bool) error {
}
} else {
if _, err := r.store.Unmount(ctr.ID, true); err != nil {
- if err == storage.ErrContainerUnknown {
+ if errors.Cause(err) == storage.ErrContainerUnknown {
// Container again gone, no error
logrus.Warnf("Storage for container %s already removed", ctr.ID)
return nil
@@ -119,7 +119,7 @@ func (r *Runtime) removeStorageContainer(idOrName string, force bool) error {
}
if err := r.store.DeleteContainer(ctr.ID); err != nil {
- if err == storage.ErrContainerUnknown {
+ if errors.Cause(err) == storage.ErrContainerUnknown {
// Container again gone, no error
logrus.Warnf("Storage for container %s already removed", ctr.ID)
return nil