return error when failed to read http response body

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
This commit is contained in:
Zhang Wei 2015-05-29 12:51:51 +08:00
parent b09240a9c3
commit a0e7dc03a2

View file

@ -71,7 +71,7 @@ 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 nil
return fmt.Errorf("Plugin Error: %s", err)
}
return fmt.Errorf("Plugin Error: %s", remoteErr)
}