module EventMachine::Protocols::Couchbase::Error

Public Class Methods

map_error_code(code) click to toggle source

@return [Couchbase::Error::Base]

# File lib/em-couchbase/error.rb, line 26
def self.map_error_code(code)
  case code
  when 0x00   # PROTOCOL_BINARY_RESPONSE_SUCCESS
    nil
  when 0x01   # PROTOCOL_BINARY_RESPONSE_KEY_ENOENT
    NotFound
  when 0x02   # PROTOCOL_BINARY_RESPONSE_KEY_EEXISTS
    KeyExists
  when 0x03   # PROTOCOL_BINARY_RESPONSE_E2BIG
    TooBig
  when 0x04   # PROTOCOL_BINARY_RESPONSE_EINVAL
    Invalid
  when 0x05   # PROTOCOL_BINARY_RESPONSE_NOT_STORED
    NotStored
  when 0x06   # PROTOCOL_BINARY_RESPONSE_DELTA_BADVAL
    DeltaBadval
  when 0x07   # PROTOCOL_BINARY_RESPONSE_NOT_MY_VBUCKET
    NotMyVbucket
  when 0x20   # PROTOCOL_BINARY_RESPONSE_AUTH_ERROR
    Auth
  when 0x22   # PROTOCOL_BINARY_RESPONSE_ERANGE
    Range
  when 0x81   # PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND
    UnknownCommand
  when 0x82   # PROTOCOL_BINARY_RESPONSE_ENOMEM
    NoMemory
  when 0x83   # PROTOCOL_BINARY_RESPONSE_NOT_SUPPORTED
    NotSupported
  when 0x84   # PROTOCOL_BINARY_RESPONSE_EINTERNAL
    Internal
  when 0x85   # PROTOCOL_BINARY_RESPONSE_EBUSY
    Busy
  else
    Base
  end
end