Exception: Pictify::RateLimitError

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

Overview

Raised when the rate limit is exceeded (HTTP 429 without a quota code).

Instance Attribute Summary collapse

Attributes inherited from Error

#response_body, #status_code

Instance Method Summary collapse

Methods inherited from Error

#message

Constructor Details

#initialize(message = nil, retry_after: nil, **kwargs) ⇒ RateLimitError

Returns a new instance of RateLimitError.



54
55
56
57
# File 'lib/pictify/errors.rb', line 54

def initialize(message = nil, retry_after: nil, **kwargs)
  @retry_after = retry_after
  super(message, **kwargs)
end

Instance Attribute Details

#retry_afterObject (readonly)

Returns the value of attribute retry_after.



52
53
54
# File 'lib/pictify/errors.rb', line 52

def retry_after
  @retry_after
end

Instance Method Details

#to_sObject



59
60
61
62
63
64
# File 'lib/pictify/errors.rb', line 59

def to_s
  base_str = super
  return "#{base_str} (retry after #{retry_after}s)" if retry_after

  base_str
end