Module: EventMachine::Protocols::Couchbase::Error

Defined in:
lib/em-couchbase/error.rb

Defined Under Namespace

Classes: Auth, Base, BucketNotFound, Busy, Connect, DeltaBadval, Internal, Invalid, KeyExists, Network, NoMemory, NotFound, NotMyVbucket, NotStored, NotSupported, Protocol, Range, TemporaryFail, Timeout, TooBig, UnknownCommand, UnknownHost, ValueFormat

Class Method Summary collapse

Class Method Details

.map_error_code(code) ⇒ Couchbase::Error::Base

Returns:



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# 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