Exception: CouchDB::HTTPError

Inherits:
Error
  • Object
show all
Defined in:
lib/couchdb/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ HTTPError

Returns a new instance of HTTPError.



84
85
86
87
88
89
# File 'lib/couchdb/errors.rb', line 84

def initialize(response)
  @code = response.code
  @body = JSON.parse response.body if response.body

  super @body ? @body['reason'] : @code
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



82
83
84
# File 'lib/couchdb/errors.rb', line 82

def body
  @body
end

#codeObject (readonly)

Returns the value of attribute code.



82
83
84
# File 'lib/couchdb/errors.rb', line 82

def code
  @code
end