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
Public Class Methods
Source
# File lib/restclient/exceptions.rb, line 114 def initialize response = nil, initial_response_code = nil @response = response @message = nil @initial_response_code = initial_response_code end
Public Instance Methods
Source
# File lib/restclient/exceptions.rb, line 145 def default_message self.class.name end
Source
# File lib/restclient/exceptions.rb, line 133 def http_body @response.body if @response end
Source
# File lib/restclient/exceptions.rb, line 120 def http_code # return integer for compatibility if @response @response.code.to_i else @initial_response_code end end
Source
# File lib/restclient/exceptions.rb, line 129 def http_headers @response.headers if @response end
Source
# File lib/restclient/exceptions.rb, line 141 def message @message || default_message end