Exception: Resourceful::UnsuccessfulHttpRequestError

Inherits:
Exception
  • Object
show all
Defined in:
lib/resourceful/exceptions.rb

Overview

This exception used to indicate that the request did not succeed. The HTTP response is included so that the appropriate actions can be taken based on the details of that response

Direct Known Subclasses

MalformedServerResponse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http_request, http_response) ⇒ UnsuccessfulHttpRequestError

Initialize new error from the HTTP request and response attributes.



11
12
13
14
15
# File 'lib/resourceful/exceptions.rb', line 11

def initialize(http_request, http_response)
  super("#{http_request.method} request to <#{http_request.uri}> failed with code #{http_response.code}")
  @http_request = http_request
  @http_response = http_response
end

Instance Attribute Details

#http_requestObject (readonly)

Returns the value of attribute http_request.



8
9
10
# File 'lib/resourceful/exceptions.rb', line 8

def http_request
  @http_request
end

#http_responseObject (readonly)

Returns the value of attribute http_response.



8
9
10
# File 'lib/resourceful/exceptions.rb', line 8

def http_response
  @http_response
end