Exception: Praroter::Throttled
- Inherits:
-
StandardError
- Object
- StandardError
- Praroter::Throttled
- Defined in:
- lib/praroter/throttled.rb
Overview
The Throttled exception gets raised when a throttle is triggered.
The exception carries additional attributes which can be used for error tracking and for creating a correct Retry-After HTTP header for a 429 response
Instance Attribute Summary collapse
-
#bucket_state ⇒ Object
readonly
Returns the value of attribute bucket_state.
- #retry_in_seconds ⇒ Object readonly
Instance Method Summary collapse
-
#initialize(bucket_state, try_again_in) ⇒ Throttled
constructor
A new instance of Throttled.
Constructor Details
#initialize(bucket_state, try_again_in) ⇒ Throttled
Returns a new instance of Throttled.
12 13 14 15 16 |
# File 'lib/praroter/throttled.rb', line 12 def initialize(bucket_state, try_again_in) @bucket_state = bucket_state @retry_in_seconds = try_again_in super("Throttled, please lower your temper and try again in #{retry_in_seconds} seconds") end |
Instance Attribute Details
#bucket_state ⇒ Object (readonly)
Returns the value of attribute bucket_state.
10 11 12 |
# File 'lib/praroter/throttled.rb', line 10 def bucket_state @bucket_state end |
#retry_in_seconds ⇒ Object (readonly)
8 9 10 |
# File 'lib/praroter/throttled.rb', line 8 def retry_in_seconds @retry_in_seconds end |