diff --git a/plugins/client.go b/plugins/client.go index 791fb7f..973858c 100644 --- a/plugins/client.go +++ b/plugins/client.go @@ -15,10 +15,19 @@ import ( ) const ( - versionMimetype = "application/vnd.docker.plugins.v1+json" + versionMimetype = "application/vnd.docker.plugins.v1.1+json" defaultTimeOut = 30 ) +type remoteError struct { + method string + err string +} + +func (e *remoteError) Error() string { + return fmt.Sprintf("Plugin Error: %s, %s", e.err, e.method) +} + // NewClient creates a new plugin client (http). func NewClient(addr string, tlsConfig tlsconfig.Options) (*Client, error) { tr := &http.Transport{} @@ -84,9 +93,9 @@ func (c *Client) callWithRetry(serviceMethod string, args interface{}, ret inter if resp.StatusCode != http.StatusOK { remoteErr, err := ioutil.ReadAll(resp.Body) if err != nil { - return fmt.Errorf("Plugin Error: %s", err) + return &remoteError{err.Error(), serviceMethod} } - return fmt.Errorf("Plugin Error: %s", remoteErr) + return &remoteError{string(remoteErr), serviceMethod} } return json.NewDecoder(resp.Body).Decode(&ret) diff --git a/plugins/pluginrpc-gen/parser.go b/plugins/pluginrpc-gen/parser.go index b9746f8..b84fef0 100644 --- a/plugins/pluginrpc-gen/parser.go +++ b/plugins/pluginrpc-gen/parser.go @@ -7,7 +7,6 @@ import ( "go/parser" "go/token" "reflect" - "strings" ) var ErrBadReturn = errors.New("found return arg with no name: all args must be named") @@ -39,7 +38,7 @@ type arg struct { } func (a *arg) String() string { - return strings.ToLower(a.Name) + " " + strings.ToLower(a.ArgType) + return a.Name + " " + a.ArgType } // Parses the given file for an interface definition with the given name