Skip to content
This repository has been archived by the owner on Nov 8, 2020. It is now read-only.

Commit

Permalink
Return error in case of non-2xx response code
Browse files Browse the repository at this point in the history
Fixes #1
  • Loading branch information
ItalyPaleAle committed Jul 28, 2019
1 parent 661dd35 commit 3c7466a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ func pinFolder(folder string, name string) error {
return err
}

// If status code isn't 2xx, we have an error
if resp.StatusCode < 200 || resp.StatusCode > 299 {
return fmt.Errorf("Invalid response status code: %d", resp.StatusCode)
}

// Output the response (should be a JSON)
fmt.Println(string(res))

Expand Down

0 comments on commit 3c7466a

Please sign in to comment.