diff options
Diffstat (limited to 'pkg/varlinkapi/util.go')
-rw-r--r-- | pkg/varlinkapi/util.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pkg/varlinkapi/util.go b/pkg/varlinkapi/util.go index e0b679934..a80c8db41 100644 --- a/pkg/varlinkapi/util.go +++ b/pkg/varlinkapi/util.go @@ -117,3 +117,19 @@ func makeListPod(pod *libpod.Pod, batchInfo shared.PsOptions) (iopodman.ListPodD } return listPod, nil } + +func handlePodCall(call iopodman.VarlinkCall, pod *libpod.Pod, ctrErrs map[string]error, err error) error { + if err != nil && ctrErrs == nil { + return call.ReplyErrorOccurred(err.Error()) + } + if ctrErrs != nil { + containerErrs := make([]iopodman.PodContainerErrorData, len(ctrErrs)) + for ctr, reason := range ctrErrs { + ctrErr := iopodman.PodContainerErrorData{Containerid: ctr, Reason: reason.Error()} + containerErrs = append(containerErrs, ctrErr) + } + return call.ReplyPodContainerError(pod.ID(), containerErrs) + } + + return nil +} |