1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-02 07:44:51 +00:00

Add IsNotFound error check

Added function for checking if an error has code 404 (is not found).
This commit is contained in:
rmweir
2019-04-23 11:34:02 -07:00
committed by Craig Jellick
parent 7387aa53a5
commit 5b40a73366

View File

@@ -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