summaryrefslogtreecommitdiff
path: root/cmd/podman/volumes/rm.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/volumes/rm.go')
-rw-r--r--cmd/podman/volumes/rm.go12
1 files changed, 3 insertions, 9 deletions
diff --git a/cmd/podman/volumes/rm.go b/cmd/podman/volumes/rm.go
index 2012b7d3a..c160b8623 100644
--- a/cmd/podman/volumes/rm.go
+++ b/cmd/podman/volumes/rm.go
@@ -2,6 +2,7 @@ package volumes
import (
"context"
+ "errors"
"fmt"
"strings"
@@ -11,7 +12,6 @@ import (
"github.com/containers/podman/v4/cmd/podman/utils"
"github.com/containers/podman/v4/libpod/define"
"github.com/containers/podman/v4/pkg/domain/entities"
- "github.com/pkg/errors"
"github.com/spf13/cobra"
)
@@ -80,15 +80,9 @@ func rm(cmd *cobra.Command, args []string) error {
}
func setExitCode(err error) {
- cause := errors.Cause(err)
- switch {
- case cause == define.ErrNoSuchVolume:
+ if errors.Is(err, define.ErrNoSuchVolume) || strings.Contains(err.Error(), define.ErrNoSuchVolume.Error()) {
registry.SetExitCode(1)
- case strings.Contains(cause.Error(), define.ErrNoSuchVolume.Error()):
- registry.SetExitCode(1)
- case cause == define.ErrVolumeBeingUsed:
- registry.SetExitCode(2)
- case strings.Contains(cause.Error(), define.ErrVolumeBeingUsed.Error()):
+ } else if errors.Is(err, define.ErrVolumeBeingUsed) || strings.Contains(err.Error(), define.ErrVolumeBeingUsed.Error()) {
registry.SetExitCode(2)
}
}