diff options
author | Frédéric Guillot <fred@miniflux.net> | 2018-05-21 12:24:48 -0700 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2018-05-21 19:58:36 -0400 |
commit | fb49ad24d5418ee9b7f65e9c36f07a1717608fcb (patch) | |
tree | bc4efdab54442f36405ea069f89fde1accf1c349 /integration/instapaper | |
parent | b270159aae97359afe02f3c4843fa0f4e9a1a1b6 (diff) |
Improve error handling in integration clients
Diffstat (limited to 'integration/instapaper')
-rw-r--r-- | integration/instapaper/instapaper.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/integration/instapaper/instapaper.go b/integration/instapaper/instapaper.go index ee44edd..3b9e91c 100644 --- a/integration/instapaper/instapaper.go +++ b/integration/instapaper/instapaper.go @@ -31,11 +31,15 @@ func (c *Client) AddURL(link, title string) error { clt := client.New(apiURL) clt.WithCredentials(c.username, c.password) response, err := clt.Get() + if err != nil { + return fmt.Errorf("instapaper: unable to send url: %v", err) + } + if response.HasServerFailure() { return fmt.Errorf("instapaper: unable to send url, status=%d", response.StatusCode) } - return err + return nil } // NewClient returns a new Instapaper client. |