Exception: Fathom::RateLimitError

Inherits:
Error
  • Object
show all
Defined in:
lib/fathom/errors.rb

Overview

Raised when rate limit is exceeded (429)

Instance Attribute Summary collapse

Attributes inherited from Error

#http_status, #response

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, response: nil, http_status: nil, headers: {}) ⇒ RateLimitError

Returns a new instance of RateLimitError.



25
26
27
28
29
# File 'lib/fathom/errors.rb', line 25

def initialize(message = nil, response: nil, http_status: nil, headers: {})
  @rate_limit_remaining = headers["RateLimit-Remaining"]&.to_i
  @rate_limit_reset = headers["RateLimit-Reset"]&.to_i
  super(message, response: response, http_status: http_status)
end

Instance Attribute Details

#rate_limit_remainingObject (readonly)

Returns the value of attribute rate_limit_remaining.



23
24
25
# File 'lib/fathom/errors.rb', line 23

def rate_limit_remaining
  @rate_limit_remaining
end

#rate_limit_resetObject (readonly)

Returns the value of attribute rate_limit_reset.



23
24
25
# File 'lib/fathom/errors.rb', line 23

def rate_limit_reset
  @rate_limit_reset
end