Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add exception for 429 Too Many Requests errors
When rate limits are hit a generic `CreateSend::ClientError` is raised with no explanatory details, which makes implementing a backoff / retry mechanism difficult. If the same request is made manually, we may see a response like: ``` { "Code" => 429, "Message" => "Subscriber was added too many times too quickly, try again later." } ``` Which allow us to differentiate between rate limiting errors and other client errors. This adds a new `CreateSend::TooManyRequests` exception to be raised when the API responds with such a 429 so we can do so in code. `CreateSend::TooManyRequests` inherits from `ClientError`, so any current code that rescues `ClientError` should be unaffected.
- Loading branch information