mirror of
https://github.com/rancher/norman.git
synced 2025-09-07 18:20:17 +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:
committed by
Craig Jellick
parent
723fdccf80
commit
0ada2dfa79
@@ -103,3 +103,11 @@ func IsAPIError(err error) bool {
|
|||||||
_, ok := err.(*APIError)
|
_, ok := err.(*APIError)
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsConflict(err error) bool {
|
||||||
|
if apiError, ok := err.(*APIError); ok {
|
||||||
|
return apiError.code.Status == 409
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user