Merge pull request #119802 from takirala/tga/update-ErrGroupDiscoveryFailed

client-go: chore: implement `Is` interface for `ErrGroupDiscoveryFailed`
This commit is contained in:
Kubernetes Prow Robot 2023-10-16 21:19:52 +02:00 committed by GitHub
commit b5cc6aab48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -420,6 +420,12 @@ func (e *ErrGroupDiscoveryFailed) Error() string {
return fmt.Sprintf("unable to retrieve the complete list of server APIs: %s", strings.Join(groups, ", "))
}
// Is makes it possible for the callers to use `errors.Is(` helper on errors wrapped with ErrGroupDiscoveryFailed error.
func (e *ErrGroupDiscoveryFailed) Is(target error) bool {
_, ok := target.(*ErrGroupDiscoveryFailed)
return ok
}
// IsGroupDiscoveryFailedError returns true if the provided error indicates the server was unable to discover
// a complete list of APIs for the client to use.
func IsGroupDiscoveryFailedError(err error) bool {