Exception: Rospatent::Errors::RateLimitError

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

Overview

Raised when API rate limit is exceeded

Instance Attribute Summary collapse

Attributes inherited from ApiError

#request_id, #response_body, #status_code

Instance Method Summary collapse

Methods inherited from ApiError

#retryable?

Constructor Details

#initialize(message, status_code = 429, retry_after = nil) ⇒ RateLimitError

Initialize a new rate limit error

Parameters:

  • message (String)

    Error message

  • status_code (Integer) (defaults to: 429)

    HTTP status code

  • retry_after (Integer) (defaults to: nil)

    Seconds to wait before retrying



57
58
59
60
# File 'lib/rospatent/errors.rb', line 57

def initialize(message, status_code = 429, retry_after = nil)
  @retry_after = retry_after
  super(message, status_code)
end

Instance Attribute Details

#retry_afterObject (readonly)

Returns the value of attribute retry_after.



51
52
53
# File 'lib/rospatent/errors.rb', line 51

def retry_after
  @retry_after
end

Instance Method Details

#to_sObject



62
63
64
65
66
# File 'lib/rospatent/errors.rb', line 62

def to_s
  msg = super
  msg += " Retry after #{@retry_after} seconds." if @retry_after
  msg
end