Browse code

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 <cpuguy83@gmail.com>

Brian Goff authored on 2016/01/07 01:29:40
Showing 1 changed files
... ...
@@ -134,11 +134,10 @@ func (c *Client) callWithRetry(serviceMethod string, data io.Reader, retry bool)
134 134
 				Err string
135 135
 			}
136 136
 			remoteErr := responseErr{}
137
-			if err := json.Unmarshal(b, &remoteErr); err != nil {
138
-				return nil, fmt.Errorf("%s: %s", serviceMethod, err)
139
-			}
140
-			if remoteErr.Err != "" {
141
-				return nil, fmt.Errorf("%s: %s", serviceMethod, remoteErr.Err)
137
+			if err := json.Unmarshal(b, &remoteErr); err == nil {
138
+				if remoteErr.Err != "" {
139
+					return nil, fmt.Errorf("%s: %s", serviceMethod, remoteErr.Err)
140
+				}
142 141
 			}
143 142
 			// old way...
144 143
 			return nil, fmt.Errorf("%s: %s", serviceMethod, string(b))