Module: Zookeeper::Exceptions

Includes:
Constants
Included in:
CZookeeper, ZookeeperBase, ZookeeperExceptions
Defined in:
lib/zookeeper/exceptions.rb,
ext/zkrb.c

Defined Under Namespace

Classes: ApiError, AuthFailed, BadArguments, BadVersion, Closing, ConnectionClosed, ConnectionLoss, ContinuationTimeoutError, DataInconsistency, DataTooLargeException, EverythingOk, HandleClosedException, InheritedConnectionError, InterruptedException, InvalidACL, InvalidCallback, InvalidState, MarshallingError, NoAuth, NoChildrenForEphemerals, NoNode, NodeExists, NotConnected, NotEmpty, Nothing, OperationTimeOut, RunTimeInconsistency, SessionExpired, SessionMoved, ShuttingDownException, SystemError, Unimplemented, ZookeeperException

Constant Summary collapse

ExpiredSession =

yes, make an alias, this is the way zookeeper refers to it

SessionExpired

Constants included from Constants

Constants::CONNECTED_EVENT_VALUES, Constants::EVENT_TYPE_NAMES, Constants::STATE_NAMES, Constants::ZAPIERROR, Constants::ZAUTHFAILED, Constants::ZBADARGUMENTS, Constants::ZBADVERSION, Constants::ZCLOSING, Constants::ZCONNECTIONLOSS, Constants::ZDATAINCONSISTENCY, Constants::ZINVALIDACL, Constants::ZINVALIDCALLBACK, Constants::ZINVALIDSTATE, Constants::ZKRB_ASYNC_CONTN_ID, Constants::ZKRB_GLOBAL_CB_REQ, Constants::ZMARSHALLINGERROR, Constants::ZNOAUTH, Constants::ZNOCHILDRENFOREPHEMERALS, Constants::ZNODEEXISTS, Constants::ZNONODE, Constants::ZNOTEMPTY, Constants::ZNOTHING, Constants::ZOK, Constants::ZOO_ASSOCIATING_STATE, Constants::ZOO_AUTH_FAILED_STATE, Constants::ZOO_CHANGED_EVENT, Constants::ZOO_CHILD_EVENT, Constants::ZOO_CLOSED_STATE, Constants::ZOO_CONNECTED_STATE, Constants::ZOO_CONNECTING_STATE, Constants::ZOO_CREATED_EVENT, Constants::ZOO_DELETED_EVENT, Constants::ZOO_EPHEMERAL, Constants::ZOO_EXPIRED_SESSION_STATE, Constants::ZOO_LOG_LEVEL_DEBUG, Constants::ZOO_LOG_LEVEL_ERROR, Constants::ZOO_LOG_LEVEL_INFO, Constants::ZOO_LOG_LEVEL_WARN, Constants::ZOO_NOTWATCHING_EVENT, Constants::ZOO_SEQUENCE, Constants::ZOO_SESSION_EVENT, Constants::ZOPERATIONTIMEOUT, Constants::ZRUNTIMEINCONSISTENCY, Constants::ZSESSIONEXPIRED, Constants::ZSESSIONMOVED, Constants::ZSYSTEMERROR, Constants::ZUNIMPLEMENTED

Constants included from ACLs::Constants

ACLs::Constants::ZOO_ANYONE_ID_UNSAFE, ACLs::Constants::ZOO_AUTH_IDS, ACLs::Constants::ZOO_CREATOR_ALL_ACL, ACLs::Constants::ZOO_OPEN_ACL_UNSAFE, ACLs::Constants::ZOO_PERM_ADMIN, ACLs::Constants::ZOO_PERM_ALL, ACLs::Constants::ZOO_PERM_CREATE, ACLs::Constants::ZOO_PERM_DELETE, ACLs::Constants::ZOO_PERM_READ, ACLs::Constants::ZOO_PERM_WRITE, ACLs::Constants::ZOO_READ_ACL_UNSAFE

Class Method Summary collapse

Methods included from Constants

#event_by_value, #state_by_value

Class Method Details

.by_code(code) ⇒ Object



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/zookeeper/exceptions.rb', line 100

def self.by_code(code)
  case code
    when ZOK then EverythingOk
    when ZSYSTEMERROR then SystemError
    when ZRUNTIMEINCONSISTENCY then RunTimeInconsistency
    when ZDATAINCONSISTENCY then DataInconsistency
    when ZCONNECTIONLOSS then ConnectionLoss
    when ZMARSHALLINGERROR then MarshallingError
    when ZUNIMPLEMENTED then Unimplemented
    when ZOPERATIONTIMEOUT then OperationTimeOut
    when ZBADARGUMENTS then BadArguments
    when ZINVALIDSTATE then InvalidState
    when ZAPIERROR then ApiError
    when ZNONODE then NoNode
    when ZNOAUTH then NoAuth
    when ZBADVERSION then BadVersion
    when ZNOCHILDRENFOREPHEMERALS then NoChildrenForEphemerals 
    when ZNODEEXISTS then NodeExists              
    when ZNOTEMPTY then NotEmpty                
    when ZSESSIONEXPIRED then SessionExpired          
    when ZINVALIDCALLBACK then InvalidCallback         
    when ZINVALIDACL then InvalidACL
    when ZAUTHFAILED then AuthFailed
    when ZCLOSING then Closing
    when ZNOTHING then Nothing
    when ZSESSIONMOVED then SessionMoved
  else ZookeeperException.new("no exception defined for code #{code}")
  end
end

.raise_on_error(code) ⇒ Object



130
131
132
133
# File 'lib/zookeeper/exceptions.rb', line 130

def self.raise_on_error(code)
  exc = self.by_code(code)
  raise exc unless exc == EverythingOk
end