summaryrefslogtreecommitdiff
path: root/pkg/errorhandling/errorhandling.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-11-02 16:11:28 +0100
committerGitHub <noreply@github.com>2021-11-02 16:11:28 +0100
commit0d5aef47d3b5322d8d7d876a27ff06b5eb71c97a (patch)
tree48a221e026a4039d10fa7e509b91f9cc220f0874 /pkg/errorhandling/errorhandling.go
parent0686f0bb2ff22abae7ca90f1b17b32d73b8615a8 (diff)
parentf2115471ddf40123a26c87f8903cc8cf2be57980 (diff)
downloadpodman-0d5aef47d3b5322d8d7d876a27ff06b5eb71c97a.tar.gz
podman-0d5aef47d3b5322d8d7d876a27ff06b5eb71c97a.tar.bz2
podman-0d5aef47d3b5322d8d7d876a27ff06b5eb71c97a.zip
Merge pull request #12051 from machacekondra/fix_http409_errorhandling
Handle HTTP 409 error messages properly
Diffstat (limited to 'pkg/errorhandling/errorhandling.go')
-rw-r--r--pkg/errorhandling/errorhandling.go14
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
+}