diff options
author | Ondra Machacek <omachace@redhat.com> | 2021-10-20 18:45:56 +0200 |
---|---|---|
committer | Ondra Machacek <omachace@redhat.com> | 2021-11-02 12:28:52 +0100 |
commit | f2115471ddf40123a26c87f8903cc8cf2be57980 (patch) | |
tree | 49f390b30e9a5434e84870c1d6498a5c64fe4974 /pkg/errorhandling | |
parent | 3147ff829b3d43c4bb3a32e09e2e3fae13ccd6f4 (diff) | |
download | podman-f2115471ddf40123a26c87f8903cc8cf2be57980.tar.gz podman-f2115471ddf40123a26c87f8903cc8cf2be57980.tar.bz2 podman-f2115471ddf40123a26c87f8903cc8cf2be57980.zip |
Handle HTTP 409 error messages properly for Pod actions
This PR fixes the case when the API return HTTP 409 response. Where the
API return the body format different then for other HTTP error codes.
Signed-off-by: Ondra Machacek <omachace@redhat.com>
Diffstat (limited to 'pkg/errorhandling')
-rw-r--r-- | pkg/errorhandling/errorhandling.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/pkg/errorhandling/errorhandling.go b/pkg/errorhandling/errorhandling.go index 44a0c3efd..04110b62a 100644 --- a/pkg/errorhandling/errorhandling.go +++ b/pkg/errorhandling/errorhandling.go @@ -83,6 +83,12 @@ func Contains(err error, sub error) bool { return strings.Contains(err.Error(), sub.Error()) } +// PodConflictErrorModel is used in remote connections with podman +type PodConflictErrorModel struct { + Errs []string + Id string //nolint +} + // ErrorModel is used in remote connections with podman type ErrorModel struct { // API root cause formatted for automated parsing @@ -106,3 +112,11 @@ func (e ErrorModel) Cause() error { func (e ErrorModel) Code() int { return e.ResponseCode } + +func (e PodConflictErrorModel) Error() string { + return strings.Join(e.Errs, ",") +} + +func (e PodConflictErrorModel) Code() int { + return 409 +} |