Exception: Restfulie::Client::HTTP::Error::RESTError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/restfulie/client/http/error.rb

Overview

Standard error thrown on major client exceptions

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#requestObject (readonly)

Returns the value of attribute request.



9
10
11
# File 'lib/restfulie/client/http/error.rb', line 9

def request
  @request
end

#responseObject (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_sObject



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