cli-plugins/manager: deprecate "IsNotFound"
These errors satisfy errdefs.IsNotFound, so make it a wrapper, and deprecate it. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@ -8,6 +8,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/containerd/errdefs"
|
||||
pluginmanager "github.com/docker/cli/cli-plugins/manager"
|
||||
"github.com/docker/cli/cli-plugins/metadata"
|
||||
"github.com/docker/cli/cli/command"
|
||||
@ -36,7 +37,7 @@ const (
|
||||
)
|
||||
|
||||
func newBuilderError(errorMsg string, pluginLoadErr error) error {
|
||||
if pluginmanager.IsNotFound(pluginLoadErr) {
|
||||
if errdefs.IsNotFound(pluginLoadErr) {
|
||||
return errors.New(errorMsg)
|
||||
}
|
||||
if pluginLoadErr != nil {
|
||||
|
||||
@ -201,7 +201,7 @@ func setupHelpCommand(dockerCli command.Cli, rootCmd, helpCmd *cobra.Command) {
|
||||
if err == nil {
|
||||
return helpcmd.Run()
|
||||
}
|
||||
if !pluginmanager.IsNotFound(err) {
|
||||
if !errdefs.IsNotFound(err) {
|
||||
return fmt.Errorf("unknown help topic: %v", strings.Join(args, " "))
|
||||
}
|
||||
}
|
||||
@ -240,7 +240,7 @@ func setHelpFunc(dockerCli command.Cli, cmd *cobra.Command) {
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
if !pluginmanager.IsNotFound(err) {
|
||||
if !errdefs.IsNotFound(err) {
|
||||
ccmd.Println(err)
|
||||
return
|
||||
}
|
||||
@ -473,7 +473,7 @@ func runDocker(ctx context.Context, dockerCli *command.DockerCli) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if !pluginmanager.IsNotFound(err) {
|
||||
if !errdefs.IsNotFound(err) {
|
||||
// For plugin not found we fall through to
|
||||
// cmd.Execute() which deals with reporting
|
||||
// "command not found" in a consistent way.
|
||||
|
||||
Reference in New Issue
Block a user