From 279dd092b6e9d5f6bb405440fa8d407349f5ad84 Mon Sep 17 00:00:00 2001 From: Brian Goff Date: Wed, 6 Jan 2016 11:29:40 -0500 Subject: [PATCH] Don't error out on plugin err with json We don't want to error out when there is a json unmarshal error since the `old way` will cause this to error. Signed-off-by: Brian Goff --- pkg/plugins/client.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkg/plugins/client.go b/pkg/plugins/client.go index d8710128ca..934a829ee4 100644 --- a/pkg/plugins/client.go +++ b/pkg/plugins/client.go @@ -134,11 +134,10 @@ func (c *Client) callWithRetry(serviceMethod string, data io.Reader, retry bool) Err string } remoteErr := responseErr{} - if err := json.Unmarshal(b, &remoteErr); err != nil { - return nil, fmt.Errorf("%s: %s", serviceMethod, err) - } - if remoteErr.Err != "" { - return nil, fmt.Errorf("%s: %s", serviceMethod, remoteErr.Err) + if err := json.Unmarshal(b, &remoteErr); err == nil { + if remoteErr.Err != "" { + return nil, fmt.Errorf("%s: %s", serviceMethod, remoteErr.Err) + } } // old way... return nil, fmt.Errorf("%s: %s", serviceMethod, string(b))