Exception: ZookeeperExceptions::ZookeeperException

Inherits:
Exception
  • Object
show all
Defined in:
lib/zookeeper/exceptions.rb

Direct Known Subclasses

ApiError, AuthFailed, BadArguments, BadVersion, Closing, ConnectionClosed, ConnectionLoss, DataInconsistency, EverythingOk, InvalidACL, InvalidCallback, InvalidState, MarshallingError, NoAuth, NoChildrenForEphemerals, NoNode, NodeExists, NotConnected, NotEmpty, Nothing, OperationTimeOut, RunTimeInconsistency, SessionExpired, SessionMoved, SystemError, Unimplemented

Defined Under Namespace

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

Class Method Summary (collapse)

Class Method Details

+ (Object) by_code(code)



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/zookeeper/exceptions.rb', line 60

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 Exception.new("no exception defined for code #{code}")
  end
end

+ (Object) raise_on_error(code)



90
91
92
93
# File 'lib/zookeeper/exceptions.rb', line 90

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