Exception: MisarReach::RateLimitError

Inherits:
ApiError
  • Object
show all
Defined in:
lib/misar_reach/errors.rb

Overview

429 — rate limited. retry_after carries the seconds to wait when provided.

Instance Attribute Summary collapse

Attributes inherited from ApiError

#body, #code, #retry_after, #status

Instance Method Summary collapse

Constructor Details

#initialize(message = "Too many requests", retry_after: nil, balance: nil, free_remaining: nil, **opts) ⇒ RateLimitError

Returns a new instance of RateLimitError.



33
34
35
36
37
# File 'lib/misar_reach/errors.rb', line 33

def initialize(message = "Too many requests", retry_after: nil, balance: nil, free_remaining: nil, **opts)
  @balance        = balance
  @free_remaining = free_remaining
  super(429, message, code: opts[:code] || "rate_limit", retry_after: retry_after, body: opts[:body])
end

Instance Attribute Details

#balanceObject (readonly)

Returns the value of attribute balance.



31
32
33
# File 'lib/misar_reach/errors.rb', line 31

def balance
  @balance
end

#free_remainingObject (readonly)

Returns the value of attribute free_remaining.



31
32
33
# File 'lib/misar_reach/errors.rb', line 31

def free_remaining
  @free_remaining
end