class Couchbase::Error::HTTP

Attributes

reason[R]
type[R]

Public Instance Methods

parse_body!() click to toggle source
# File lib/couchbase/view.rb, line 36
def parse_body!
  if @body
    hash = MultiJson.load(@body)
    if hash["errors"]
      @type = :invalid_arguments
      @reason = hash["errors"].values.join(" ")
    else
      @type = hash["error"]
      @reason = hash["reason"]
    end
  end
rescue MultiJson::DecodeError
  @type = @reason = nil
end
to_s() click to toggle source
Calls superclass method Couchbase::Error::Base#to_s
# File lib/couchbase/view.rb, line 51
def to_s
  str = super
  if @type || @reason
    str.sub(/ \(/, ": #{[@type, @reason].compact.join(": ")} (")
  else
    str
  end
end