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[W]
original_exception[RW]
response[RW]
Public Class Methods
new(response = nil, initial_response_code = nil)
click to toggle 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
default_message()
click to toggle source
# File lib/restclient/exceptions.rb, line 145 def default_message self.class.name end
http_body()
click to toggle source
# File lib/restclient/exceptions.rb, line 133 def http_body @response.body if @response end
http_code()
click to toggle 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
http_headers()
click to toggle source
# File lib/restclient/exceptions.rb, line 129 def http_headers @response.headers if @response end
message()
click to toggle source
# File lib/restclient/exceptions.rb, line 141 def message @message || default_message end
to_s()
click to toggle source
# File lib/restclient/exceptions.rb, line 137 def to_s message end