1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-04 08:45:22 +00:00

Add IsConflict to httperror

Add an IsConflict function to httperror package.  The purpose of this
change is to allow the testing of APIErrors in a controlled and
centralized way.

Supports functionality in issue:
https://github.com/rancher/rancher/issues/11378
This commit is contained in:
Nathan Jenan
2018-03-13 16:06:41 -07:00
committed by Craig Jellick
parent 723fdccf80
commit 0ada2dfa79

View File

@@ -103,3 +103,11 @@ func IsAPIError(err error) bool {
_, ok := err.(*APIError)
return ok
}
func IsConflict(err error) bool {
if apiError, ok := err.(*APIError); ok {
return apiError.code.Status == 409
}
return false
}