Browse code

client: remove redundant pluginPermissionDenied

It was only used in a single location, and only a "convenience" type,
not used to detect a specific error.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2022/08/24 05:52:36
Showing 2 changed files
... ...
@@ -58,14 +58,6 @@ func (e objectNotFoundError) Error() string {
58 58
 	return fmt.Sprintf("Error: No such %s: %s", e.object, e.id)
59 59
 }
60 60
 
61
-type pluginPermissionDenied struct {
62
-	name string
63
-}
64
-
65
-func (e pluginPermissionDenied) Error() string {
66
-	return "Permission denied while installing plugin " + e.name
67
-}
68
-
69 61
 // NewVersionError returns an error if the APIVersion required
70 62
 // if less than the current supported version
71 63
 func (cli *Client) NewVersionError(APIrequired, feature string) error {
... ...
@@ -107,7 +107,7 @@ func (cli *Client) checkPluginPermissions(ctx context.Context, query url.Values,
107 107
 			return nil, err
108 108
 		}
109 109
 		if !accept {
110
-			return nil, pluginPermissionDenied{options.RemoteRef}
110
+			return nil, errors.Errorf("permission denied while installing plugin %s", options.RemoteRef)
111 111
 		}
112 112
 	}
113 113
 	return privileges, nil