client: make IsErrNotFound an alias for errdefs.IsNotFound
None of the client will return the old error-types, so there's no need to keep the compatibility code. We can consider deprecating this function in favor of the errdefs equivalent this. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
f70d9933d1
commit
685b3d820a
1 changed files with 2 additions and 12 deletions
|
@ -31,20 +31,10 @@ func ErrorConnectionFailed(host string) error {
|
|||
return errConnectionFailed{host: host}
|
||||
}
|
||||
|
||||
// Deprecated: use the errdefs.NotFound() interface instead. Kept for backward compatibility
|
||||
type notFound interface {
|
||||
error
|
||||
NotFound() bool
|
||||
}
|
||||
|
||||
// IsErrNotFound returns true if the error is a NotFound error, which is returned
|
||||
// by the API when some object is not found.
|
||||
// by the API when some object is not found. It is an alias for [errdefs.IsNotFound].
|
||||
func IsErrNotFound(err error) bool {
|
||||
if errdefs.IsNotFound(err) {
|
||||
return true
|
||||
}
|
||||
var e notFound
|
||||
return errors.As(err, &e)
|
||||
return errdefs.IsNotFound(err)
|
||||
}
|
||||
|
||||
type objectNotFoundError struct {
|
||||
|
|
Loading…
Reference in a new issue