generated from ZEISS/template-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e66396a
commit 90e5418
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package errorx | ||
|
||
import "k8s.io/apimachinery/pkg/api/errors" | ||
|
||
// IsNotFound checks if an error is a not found error. | ||
func IsNotFound(err error) bool { | ||
return err != nil && errors.IsNotFound(err) | ||
} | ||
|
||
// IsAlreadyExists checks if an error is an already exists error. | ||
func IsAlreadyExists(err error) bool { | ||
return err != nil && errors.IsAlreadyExists(err) | ||
} | ||
|
||
// IsConflict checks if an error is a conflict error. | ||
func IsConflict(err error) bool { | ||
return err != nil && errors.IsConflict(err) | ||
} | ||
|
||
// IsInvalid checks if an error is an invalid error. | ||
func IsInvalid(err error) bool { | ||
return err != nil && errors.IsInvalid(err) | ||
} | ||
|
||
// IsUnauthorized checks if an error is an unauthorized error. | ||
func IsUnauthorized(err error) bool { | ||
return err != nil && errors.IsUnauthorized(err) | ||
} | ||
|
||
// IsForbidden checks if an error is a forbidden error. | ||
func IsForbidden(err error) bool { | ||
return err != nil && errors.IsForbidden(err) | ||
} | ||
|
||
// IsServiceUnavailable checks if an error is a service unavailable error. | ||
func IsServiceUnavailable(err error) bool { | ||
return err != nil && errors.IsServiceUnavailable(err) | ||
} | ||
|
||
// IsTimeout checks if an error is a timeout error. | ||
func IsTimeout(err error) bool { | ||
return err != nil && errors.IsTimeout(err) | ||
} | ||
|
||
// IsServerTimeout checks if an error is a server timeout error. | ||
func IsServerTimeout(err error) bool { | ||
return err != nil && errors.IsServerTimeout(err) | ||
} | ||
|
||
// IsGone checks if an error is a gone error. | ||
func IsGone(err error) bool { | ||
return err != nil && errors.IsGone(err) | ||
} | ||
|
||
// IsBadRequest checks if an error is a bad request error. | ||
func IsBadRequest(err error) bool { | ||
return err != nil && errors.IsBadRequest(err) | ||
} |