diff options
author | Peter Hunt <pehunt@redhat.com> | 2019-07-23 15:30:05 -0400 |
---|---|---|
committer | Peter Hunt <pehunt@redhat.com> | 2019-07-23 16:49:04 -0400 |
commit | 01a8483a59eed8bc706b5219b903704544b66c10 (patch) | |
tree | a4d389c4964cba790ea3b483a3d0265bb53778d1 /pkg/varlinkapi/containers.go | |
parent | 82dce36fb6ef3839c029b7450a75c85cf28cf377 (diff) | |
download | podman-01a8483a59eed8bc706b5219b903704544b66c10.tar.gz podman-01a8483a59eed8bc706b5219b903704544b66c10.tar.bz2 podman-01a8483a59eed8bc706b5219b903704544b66c10.zip |
refactor to reduce duplicated error parsing
Signed-off-by: Peter Hunt <pehunt@redhat.com>
Diffstat (limited to 'pkg/varlinkapi/containers.go')
-rw-r--r-- | pkg/varlinkapi/containers.go | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/pkg/varlinkapi/containers.go b/pkg/varlinkapi/containers.go index 6e2b26c0e..cd5f305c9 100644 --- a/pkg/varlinkapi/containers.go +++ b/pkg/varlinkapi/containers.go @@ -837,15 +837,9 @@ func (i *LibpodAPI) ExecContainer(call iopodman.VarlinkCall, opts iopodman.ExecO ecErr := <-ecErrChan - exitCode := ecErr.ExitCode - if errors.Cause(ecErr.Error) == define.ErrOCIRuntimePermissionDenied { - exitCode = define.ExecErrorCodeCannotInvoke - } - if errors.Cause(ecErr.Error) == define.ErrOCIRuntimeNotFound { - exitCode = define.ExecErrorCodeNotFound - } + exitCode := define.TranslateExecErrorToExitCode(int(ecErr.ExitCode), ecErr.Error) - if err = virtwriter.HangUp(writer, exitCode); err != nil { + if err = virtwriter.HangUp(writer, uint32(exitCode)); err != nil { logrus.Errorf("ExecContainer failed to HANG-UP on %s: %s", ctr.ID(), err.Error()) } |