Skip to content

Commit

Permalink
fix: Remove workaround known API bug (#198)
Browse files Browse the repository at this point in the history
Removes workaround for #79, which has been fixed in production API.
  • Loading branch information
Anthony Tran authored Feb 4, 2021
1 parent 04185da commit 01b90b7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
15 changes: 0 additions & 15 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"github.com/go-resty/resty/v2"
"github.com/rs/zerolog/log"
"net/http"
"strings"
)

// DefaultBaseURL is the default base URL for the Rollbar API.
Expand Down Expand Up @@ -89,20 +88,6 @@ func errorFromResponse(resp *resty.Response) error {
switch resp.StatusCode() {
case http.StatusOK, http.StatusCreated:
return nil
case http.StatusForbidden:
// Workaround for known API bug:
// https://github.com/rollbar/terraform-provider-rollbar/issues/79
er := resp.Error().(*ErrorResult)
if strings.Contains(er.Message, "not found in this account") {
log.Debug().
Str("status", resp.Status()).
Int("status_code", resp.StatusCode()).
Str("error_message", er.Message).
Int("error_code", er.Err).
Msg("Workaround entity not found API bug")
return ErrNotFound
}
fallthrough
case http.StatusUnauthorized:
return ErrUnauthorized
case http.StatusNotFound:
Expand Down
5 changes: 1 addition & 4 deletions client/team_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,7 @@ func (s *Suite) TestReadTeam() {
_, err = s.client.ReadTeam(0)
s.NotNil(err)

// FIXME: Workaround API bug
// https://github.com/rollbar/terraform-provider-rollbar/issues/79
r = httpmock.NewJsonResponderOrPanic(http.StatusForbidden,
ErrorResult{Err: 1, Message: "Team not found in this account."})
r = responderFromFixture("team/read.json", http.StatusNotFound)
httpmock.RegisterResponder("GET", u, r)
_, err = s.client.ReadTeam(teamID)
s.Equal(ErrNotFound, err)
Expand Down

0 comments on commit 01b90b7

Please sign in to comment.