Skip to content

Commit

Permalink
transformation of 404 HTTP error to a NotFoundError type
Browse files Browse the repository at this point in the history
  • Loading branch information
skudriavtsev committed Nov 18, 2021
1 parent a067fdd commit b4e0498
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ func getHTTPResponseError(resp *http.Response) error {
content, _ := ioutil.ReadAll(resp.Body)
msg := fmt.Sprintf("WAPI request error: %d('%s')\nContents:\n%s\n", resp.StatusCode, resp.Status, content)
log.Printf(msg)
if resp.StatusCode == http.StatusNotFound {
return NewNotFoundError(msg)
}
return errors.New(msg)
}

Expand Down

0 comments on commit b4e0498

Please sign in to comment.