From fb49ad24d5418ee9b7f65e9c36f07a1717608fcb Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Mon, 21 May 2018 12:24:48 -0700 Subject: Improve error handling in integration clients --- integration/instapaper/instapaper.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'integration/instapaper') 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. -- cgit v1.2.3