client: use stdlib errors

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-08-04 20:46:30 +02:00
parent e06826601c
commit bfce6556c4
26 changed files with 86 additions and 85 deletions

View File

@@ -3,6 +3,8 @@ package client
import (
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"net/url"
@@ -11,7 +13,6 @@ import (
"github.com/distribution/reference"
"github.com/moby/moby/api/types"
"github.com/moby/moby/api/types/registry"
"github.com/pkg/errors"
)
// PluginInstallOptions holds parameters to install a plugin.
@@ -36,7 +37,7 @@ type PluginInstallOptions struct {
func (cli *Client) PluginInstall(ctx context.Context, name string, options PluginInstallOptions) (_ io.ReadCloser, retErr error) {
query := url.Values{}
if _, err := reference.ParseNormalizedNamed(options.RemoteRef); err != nil {
return nil, errors.Wrap(err, "invalid remote reference")
return nil, fmt.Errorf("invalid remote reference: %w", err)
}
query.Set("remote", options.RemoteRef)
@@ -128,7 +129,7 @@ func (cli *Client) checkPluginPermissions(ctx context.Context, query url.Values,
return nil, err
}
if !accept {
return nil, errors.Errorf("permission denied while installing plugin %s", options.RemoteRef)
return nil, errors.New("permission denied while installing plugin " + options.RemoteRef)
}
}
return privileges, nil