Skip to content

Commit

Permalink
Merge pull request #13 from andrewhavck/add_support_for_429_error
Browse files Browse the repository at this point in the history
Add support for capturing Dyn Rate Limit requests
  • Loading branch information
nesv authored Apr 21, 2017
2 parents be20024 + eed467d commit 1caba68
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dynect/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const (
var (
PollingInterval = 1 * time.Second
ErrPromotedToJob = errors.New("promoted to job")
ErrRateLimited = errors.New("too many requests")
)

// handleJobRedirect overrides the net/http.DefaultClient's redirection policy
Expand Down Expand Up @@ -256,6 +257,9 @@ func (c *Client) Do(method, endpoint string, requestData, responseData interface
}

return nil

case 429:
return ErrRateLimited
}

// If we got here, this means that the client does not know how to
Expand Down

0 comments on commit 1caba68

Please # to comment.