Exception: Couchbase::Error::CouchbaseError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/couchbase/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg = nil, context = nil) ⇒ CouchbaseError

Returns a new instance of CouchbaseError.



24
25
26
27
# File 'lib/couchbase/errors.rb', line 24

def initialize(msg = nil, context = nil)
  @context = context unless context.nil?
  super(msg)
end

Instance Attribute Details

#contextHash (readonly)

Returns attributes associated with the error.

Returns:

  • (Hash)

    attributes associated with the error



22
23
24
# File 'lib/couchbase/errors.rb', line 22

def context
  @context
end

Instance Method Details

#to_sObject



29
30
31
# File 'lib/couchbase/errors.rb', line 29

def to_s
  defined?(@context) ? "#{super}, context=#{JSON.generate(@context)}" : super
end