Exception: Recliner::CouchDBError
- Defined in:
- lib/recliner/exceptions.rb
Overview
Encapsulates a critical error from CouchDB. Raised by the Recliner base methods when an error response is returned. Use the error
and reason
methods to retrieve the specific error.
Instance Method Summary collapse
- #error ⇒ Object
-
#initialize(response = nil) ⇒ CouchDBError
constructor
A new instance of CouchDBError.
- #message ⇒ Object
- #reason ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(response = nil) ⇒ CouchDBError
Returns a new instance of CouchDBError.
6 7 8 |
# File 'lib/recliner/exceptions.rb', line 6 def initialize(response=nil) @error = JSON.parse(response) if response end |
Instance Method Details
#error ⇒ Object
10 11 12 |
# File 'lib/recliner/exceptions.rb', line 10 def error @error['error'] if @error end |
#message ⇒ Object
18 19 20 |
# File 'lib/recliner/exceptions.rb', line 18 def "CouchDB error: #{error} (#{reason})" end |
#reason ⇒ Object
14 15 16 |
# File 'lib/recliner/exceptions.rb', line 14 def reason @error['reason'] if @error end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/recliner/exceptions.rb', line 22 def to_s end |