Exception: PriceHubble::RequestError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/pricehubble/errors.rb

Overview

Generic request/response exception class.

Direct Known Subclasses

AuthenticationError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, response = nil) ⇒ RequestError

Create a new instance of the error.

Parameters:

  • message (String) (defaults to: nil)

    the error message

  • response (Faraday::Response) (defaults to: nil)

    the response



16
17
18
19
20
21
# File 'lib/pricehubble/errors.rb', line 16

def initialize(message = nil, response = nil)
  @response = response
  message ||= response.body.message if response.body.respond_to? :message

  super(message)
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



10
11
12
# File 'lib/pricehubble/errors.rb', line 10

def response
  @response
end