class 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[RW]
response[RW]

Public Class Methods

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

  # 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 75
def http_body
  @response.body
end
http_code() click to toggle source
# File lib/restclient/exceptions.rb, line 70
def http_code
  # return integer for compatibility
  @response.code.to_i if @response
end
inspect() click to toggle source
# File lib/restclient/exceptions.rb, line 79
def inspect
  "#{self.class} : #{http_code} #{message}"
end