Exception: BrightData::RateLimitError

Inherits:
HTTPError show all
Defined in:
lib/brightdata/errors.rb

Overview

Raised on 429 Too Many Requests responses.

Instance Attribute Summary collapse

Attributes inherited from HTTPError

#body, #response, #status

Instance Method Summary collapse

Constructor Details

#initialize(message, status: 429, body: nil, response: nil, retry_after: nil) ⇒ RateLimitError

Returns a new instance of RateLimitError.

Parameters:

  • message (String)

    human-readable error message

  • status (Integer) (defaults to: 429)

    HTTP status

  • body (String, nil) (defaults to: nil)

    raw response body

  • response (Net::HTTPResponse, nil) (defaults to: nil)

    raw Net::HTTP response

  • retry_after (Integer, nil) (defaults to: nil)

    retry delay in seconds



53
54
55
56
# File 'lib/brightdata/errors.rb', line 53

def initialize(message, status: 429, body: nil, response: nil, retry_after: nil)
  super(message, status:, body:, response:)
  @retry_after = retry_after
end

Instance Attribute Details

#retry_afterInteger? (readonly)

Returns value of the ‘Retry-After` header in seconds, or nil if absent.

Returns:

  • (Integer, nil)

    value of the ‘Retry-After` header in seconds, or nil if absent



46
47
48
# File 'lib/brightdata/errors.rb', line 46

def retry_after
  @retry_after
end