Skip to content

Commit

Permalink
fixes #7 no panic on errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathaniel Niosco committed Apr 16, 2019
1 parent 5797123 commit 5c601b7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions request.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (req *Request) Get(url string, params []string) ([]byte, error) {
EndBytes()

if len(errs) > 0 {
panic(errs)
return nil, errs[0]
}

if res.StatusCode != 200 {
Expand Down Expand Up @@ -82,7 +82,7 @@ func (req *Request) Post(url, data string, params []string) ([]byte, error) {
EndBytes()

if len(errs) > 0 {
panic(errs)
return nil, errs[0]
}

if res.StatusCode != 200 && res.StatusCode != 202 {
Expand Down Expand Up @@ -110,7 +110,7 @@ func (req *Request) Patch(url, data string, params []string) ([]byte, error) {
EndBytes()

if len(errs) > 0 {
panic(errs)
return nil, errs[0]
}

if res.StatusCode != 200 {
Expand All @@ -131,7 +131,7 @@ func (req *Request) Delete(url string) ([]byte, error) {
EndBytes()

if len(errs) > 0 {
panic(errs)
return nil, errs[0]
}

if res.StatusCode != 200 {
Expand Down

0 comments on commit 5c601b7

Please sign in to comment.