Exception: Philiprehberger::HttpClient::HttpError

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

Overview

Raised when a response status does not match expected values.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ HttpError

Returns a new instance of HttpError.

Parameters:

  • response (Response)

    the HTTP response that triggered the error



22
23
24
25
# File 'lib/philiprehberger/http_client/errors.rb', line 22

def initialize(response)
  @response = response
  super("HTTP #{response.status}: #{response.body.to_s[0..200]}")
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



19
20
21
# File 'lib/philiprehberger/http_client/errors.rb', line 19

def response
  @response
end