Parent

RestClient::Exception

This is the base RestClient exception class. Rescue it if you want to catch any exception that your request might raise You can get the status code by e.http_code, or see anything about the response via e.response. For example, the entire result body (which is probably an HTML error page) is e.response.

Attributes

message[W]
response[RW]

Public Class Methods

new(response = nil, initial_response_code = nil) click to toggle source
# File lib/restclient/exceptions.rb, line 86
def initialize response = nil, initial_response_code = nil
  @response = response
  @initial_response_code = initial_response_code

  # compatibility: this make the exception behave like a Net::HTTPResponse
  response.extend ResponseForException if response
end

Public Instance Methods

http_body() click to toggle source
# File lib/restclient/exceptions.rb, line 103
def http_body
  @response.body if @response
end
http_code() click to toggle source
# File lib/restclient/exceptions.rb, line 94
def http_code
  # return integer for compatibility
  if @response
    @response.code.to_i
  else
    @initial_response_code
  end
end
inspect() click to toggle source
# File lib/restclient/exceptions.rb, line 107
def inspect
  "#{message}: #{http_body}"
end
message() click to toggle source
# File lib/restclient/exceptions.rb, line 115
def message
  @message || self.class.name
end
to_s() click to toggle source
# File lib/restclient/exceptions.rb, line 111
def to_s
  inspect
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.