Exception: Couchbase::Error::HTTP

Inherits:
Base
  • Object
show all
Defined in:
ext/couchbase_ext/couchbase_ext.c,
lib/couchbase/view.rb,
ext/couchbase_ext/couchbase_ext.c

Overview

HTTP error with status code

Since:

Instance Attribute Summary (collapse)

Attributes inherited from Base

#cas, #error, #inner_exception, #key, #operation, #status

Instance Method Summary (collapse)

Instance Attribute Details

- (Object) reason (readonly)

Returns the value of attribute reason



34
35
36
# File 'lib/couchbase/view.rb', line 34

def reason
  @reason
end

- (Object) type (readonly)

Returns the value of attribute type



34
35
36
# File 'lib/couchbase/view.rb', line 34

def type
  @type
end

Instance Method Details

- (Object) parse_body!



36
37
38
39
40
41
42
43
44
# File 'lib/couchbase/view.rb', line 36

def parse_body!
  if @body
    hash = MultiJson.load(@body)
    @type = hash["error"]
    @reason = hash["reason"]
  end
rescue MultiJson::DecodeError
  @type = @reason = nil
end

- (Object) to_s



46
47
48
49
50
51
52
# File 'lib/couchbase/view.rb', line 46

def to_s
  str = super
  if @type || @reason
    str.sub(/ \(/, ": #{[@type, @reason].compact.join(": ")} (")
  end
  str
end