diff options
Diffstat (limited to 'cmd/podman/errors.go')
-rw-r--r-- | cmd/podman/errors.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/cmd/podman/errors.go b/cmd/podman/errors.go index 9731037f4..ae9e73e62 100644 --- a/cmd/podman/errors.go +++ b/cmd/podman/errors.go @@ -8,6 +8,8 @@ import ( "os/exec" "syscall" + "github.com/containers/libpod/libpod/define" + "github.com/pkg/errors" "github.com/sirupsen/logrus" ) @@ -24,3 +26,14 @@ func outputError(err error) { fmt.Fprintln(os.Stderr, "Error:", err.Error()) } } + +func setExitCode(err error) int { + cause := errors.Cause(err) + switch cause { + case define.ErrNoSuchCtr: + return 1 + case define.ErrCtrStateInvalid: + return 2 + } + return exitCode +} |