Exception: Restfulie::Client::HTTP::Error::RESTError
- Inherits:
-
StandardError
- Object
- StandardError
- Restfulie::Client::HTTP::Error::RESTError
- Defined in:
- lib/restfulie/client/http/error.rb
Overview
Standard error thrown on major client exceptions
Direct Known Subclasses
AutoFollowWithoutLocationError, ClientError, Redirection, ServerError, ServerNotAvailableError, UnknownError
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(request, response) ⇒ RESTError
constructor
A new instance of RESTError.
- #to_s ⇒ Object
Constructor Details
#initialize(request, response) ⇒ RESTError
Returns a new instance of RESTError.
11 12 13 14 |
# File 'lib/restfulie/client/http/error.rb', line 11 def initialize(request, response) @request = request @response = response end |
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
9 10 11 |
# File 'lib/restfulie/client/http/error.rb', line 9 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
8 9 10 |
# File 'lib/restfulie/client/http/error.rb', line 8 def response @response end |
Instance Method Details
#to_s ⇒ Object
16 17 18 19 20 21 |
# File 'lib/restfulie/client/http/error.rb', line 16 def to_s "HTTP error #{@response.code} when invoking #{@request.host} via #{@response.method}. " + ((@response.body.blank?) ? "No additional data was sent." : "The complete response was:\n" + @response.body) rescue super end |