Exception: Ask::RateLimitError
- Defined in:
- lib/ask/errors.rb
Overview
Raised when the API rate limit is hit. Carries optional category, type, and retry_after for intelligent handling.
Instance Attribute Summary collapse
-
#category ⇒ Symbol?
readonly
Who rate-limited (:vendor, :local).
-
#rate_limit_type ⇒ Symbol?
readonly
Which limit was hit (:requests, :tokens, :concurrent, :budget).
-
#retry_after ⇒ Integer, ...
readonly
Suggested seconds to wait before retrying.
Instance Method Summary collapse
-
#initialize(message, category: nil, rate_limit_type: nil, retry_after: nil) ⇒ RateLimitError
constructor
A new instance of RateLimitError.
Constructor Details
#initialize(message, category: nil, rate_limit_type: nil, retry_after: nil) ⇒ RateLimitError
Returns a new instance of RateLimitError.
66 67 68 69 70 71 |
# File 'lib/ask/errors.rb', line 66 def initialize(, category: nil, rate_limit_type: nil, retry_after: nil) @category = category @rate_limit_type = rate_limit_type @retry_after = retry_after super() end |
Instance Attribute Details
#category ⇒ Symbol? (readonly)
Returns who rate-limited (:vendor, :local).
58 59 60 |
# File 'lib/ask/errors.rb', line 58 def category @category end |
#rate_limit_type ⇒ Symbol? (readonly)
Returns which limit was hit (:requests, :tokens, :concurrent, :budget).
61 62 63 |
# File 'lib/ask/errors.rb', line 61 def rate_limit_type @rate_limit_type end |
#retry_after ⇒ Integer, ... (readonly)
Returns suggested seconds to wait before retrying.
64 65 66 |
# File 'lib/ask/errors.rb', line 64 def retry_after @retry_after end |