1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-01 17:38:37 +00:00

Improve error handling in integration clients

This commit is contained in:
Frédéric Guillot 2018-05-21 12:24:48 -07:00
parent b270159aae
commit fb49ad24d5
3 changed files with 15 additions and 3 deletions

View file

@ -36,11 +36,15 @@ func (c *Client) AddBookmark(link, title, tags string, markAsUnread bool) error
clt := client.New("https://api.pinboard.in/v1/posts/add?" + values.Encode())
response, err := clt.Get()
if err != nil {
return fmt.Errorf("pinboard: unable to send bookmark: %v", err)
}
if response.HasServerFailure() {
return fmt.Errorf("pinboard: unable to send bookmark, status=%d", response.StatusCode)
}
return err
return nil
}
// NewClient returns a new Pinboard client.