class CouchRest::Exception
This is the base CouchRest
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
default_message()
click to toggle source
# File lib/couchrest/exceptions.rb, line 76 def self.default_message self.name end
new(response = nil)
click to toggle source
# File lib/couchrest/exceptions.rb, line 46 def initialize response = nil @response = response @message = nil end
Public Instance Methods
http_body()
click to toggle source
# File lib/couchrest/exceptions.rb, line 60 def http_body @response.body if @response end
http_code()
click to toggle source
# File lib/couchrest/exceptions.rb, line 51 def http_code # return integer for compatibility @response.status if @response end
http_headers()
click to toggle source
# File lib/couchrest/exceptions.rb, line 56 def http_headers @response.headers if @response end
inspect()
click to toggle source
# File lib/couchrest/exceptions.rb, line 64 def inspect "#{message}: #{http_body}" end
message()
click to toggle source
# File lib/couchrest/exceptions.rb, line 72 def message @message || self.class.default_message end
to_s()
click to toggle source
# File lib/couchrest/exceptions.rb, line 68 def to_s inspect end