Exception: Prorate::Throttled

Inherits:
StandardError
  • Object
show all
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

Instance Method Summary collapse

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_secondsObject (readonly)



13
14
15
# File 'lib/prorate/throttled.rb', line 13

def retry_in_seconds
  @retry_in_seconds
end

#throttle_nameObject (readonly)



10
11
12
# File 'lib/prorate/throttled.rb', line 10

def throttle_name
  @throttle_name
end