mirror of
https://github.com/rancher/norman.git
synced 2025-09-03 00:06:24 +00:00
Add IsNotFound error check
Added function for checking if an error has code 404 (is not found).
This commit is contained in:
@@ -105,6 +105,14 @@ func IsAPIError(err error) bool {
|
|||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsNotFound(err error) bool {
|
||||||
|
if apiError, ok := err.(*APIError); ok {
|
||||||
|
return apiError.Code.Status == 404
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func IsConflict(err error) bool {
|
func IsConflict(err error) bool {
|
||||||
if apiError, ok := err.(*APIError); ok {
|
if apiError, ok := err.(*APIError); ok {
|
||||||
return apiError.Code.Status == 409
|
return apiError.Code.Status == 409
|
||||||
|
Reference in New Issue
Block a user