Exception: PEClient::HTTPError

Inherits:
Error
  • Object
show all
Defined in:
lib/pe_client/error.rb

Overview

Generic HTTP errors

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response, message = nil) ⇒ HTTPError

Returns a new instance of HTTPError.

Parameters:

  • response (Faraday::Response)

    The HTTP response that caused the error.

  • message (String) (defaults to: nil)

    An optional custom error message.



30
31
32
33
# File 'lib/pe_client/error.rb', line 30

def initialize(response, message = nil)
  @response = response
  super(message || "HTTP #{@response.status} Error: #{@response.body}")
end

Instance Attribute Details

#responseFaraday::Response (readonly)

The HTTP response that caused the error.

Returns:

  • (Faraday::Response)

    the current value of response



25
26
27
# File 'lib/pe_client/error.rb', line 25

def response
  @response
end