mirror of
https://github.com/rancher/norman.git
synced 2025-09-01 23:36:58 +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
|
||||
}
|
||||
|
||||
func IsNotFound(err error) bool {
|
||||
if apiError, ok := err.(*APIError); ok {
|
||||
return apiError.Code.Status == 404
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func IsConflict(err error) bool {
|
||||
if apiError, ok := err.(*APIError); ok {
|
||||
return apiError.Code.Status == 409
|
||||
|
Reference in New Issue
Block a user