Переглянути джерело

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>
Sebastiaan van Stijn 2 роки тому
батько
коміт
685b3d820a
1 змінених файлів з 2 додано та 12 видалено
  1. 2 12
      client/errors.go

+ 2 - 12
client/errors.go

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