Exception: Prorate::Throttled
- Inherits:
-
StandardError
- Object
- StandardError
- Prorate::Throttled
- Defined in:
- lib/prorate/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
- #retry_in_seconds ⇒ Object readonly
- #throttle_name ⇒ Object readonly
Instance Method Summary collapse
-
#initialize(throttle_name, try_again_in) ⇒ Throttled
constructor
A new instance of Throttled.
Constructor Details
#initialize(throttle_name, try_again_in) ⇒ Throttled
Returns a new instance of Throttled.
15 16 17 18 19 |
# File 'lib/prorate/throttled.rb', line 15 def initialize(throttle_name, try_again_in) @throttle_name = throttle_name @retry_in_seconds = try_again_in super("Throttled, please lower your temper and try again in #{retry_in_seconds} seconds") end |
Instance Attribute Details
#retry_in_seconds ⇒ Object (readonly)
13 14 15 |
# File 'lib/prorate/throttled.rb', line 13 def retry_in_seconds @retry_in_seconds end |
#throttle_name ⇒ Object (readonly)
10 11 12 |
# File 'lib/prorate/throttled.rb', line 10 def throttle_name @throttle_name end |