From: Florian Forster Date: Wed, 31 Jan 2018 14:55:40 +0000 (+0100) Subject: Package fitbit: Handle errors from ioutil.ReadAll() and fix warning message. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=df04bfbc10132c223a019e412cf501c11990e7cb;p=kraftakt.git Package fitbit: Handle errors from ioutil.ReadAll() and fix warning message. --- diff --git a/fitbit/fitbit.go b/fitbit/fitbit.go index 8a07fb7..7e38bf1 100644 --- a/fitbit/fitbit.go +++ b/fitbit/fitbit.go @@ -170,7 +170,10 @@ func (c *Client) ActivitySummary(ctx context.Context, date string) (*ActivitySum } defer res.Body.Close() - data, _ := ioutil.ReadAll(res.Body) + data, err := ioutil.ReadAll(res.Body) + if err != nil { + return nil, err + } log.Debugf(ctx, "GET %s -> %s", url, data) var summary ActivitySummary @@ -316,7 +319,7 @@ func (c *Client) ListSubscriptions(ctx context.Context, collection string) ([]Su } for _, err := range errs { - log.Warningf(ctx, err) + log.Warningf(ctx, "%v", err) } return ret, nil