mirror of
https://github.com/containers/podman.git
synced 2025-05-17 23:26:08 +08:00
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>
This commit is contained in:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user