Exception: RubyPi::RateLimitError
- Defined in:
- lib/ruby_pi/errors.rb
Overview
Raised when the API returns a rate limit response (HTTP 429). The caller should back off and retry after the indicated period.
Instance Attribute Summary collapse
-
#retry_after ⇒ Float?
readonly
Suggested retry delay in seconds, if provided by the API.
Attributes inherited from ApiError
Instance Method Summary collapse
-
#initialize(message = nil, retry_after: nil, response_body: nil) ⇒ RateLimitError
constructor
A new instance of RateLimitError.
Constructor Details
#initialize(message = nil, retry_after: nil, response_body: nil) ⇒ RateLimitError
Returns a new instance of RateLimitError.
61 62 63 64 |
# File 'lib/ruby_pi/errors.rb', line 61 def initialize( = nil, retry_after: nil, response_body: nil) @retry_after = retry_after super( || "Rate limit exceeded", status_code: 429, response_body: response_body) end |
Instance Attribute Details
#retry_after ⇒ Float? (readonly)
Returns suggested retry delay in seconds, if provided by the API.
56 57 58 |
# File 'lib/ruby_pi/errors.rb', line 56 def retry_after @retry_after end |