/usr/lib/python3/dist-packages/kazoo/exceptions.py is in python3-kazoo 2.2.1-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 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 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 89 90 91 92 93 94 95 96 97 98 99 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 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | """Kazoo Exceptions"""
from collections import defaultdict
class KazooException(Exception):
"""Base Kazoo exception that all other kazoo library exceptions
inherit from"""
class ZookeeperError(KazooException):
"""Base Zookeeper exception for errors originating from the
Zookeeper server"""
class CancelledError(KazooException):
"""Raised when a process is cancelled by another thread"""
class ConfigurationError(KazooException):
"""Raised if the configuration arguments to an object are
invalid"""
class ZookeeperStoppedError(KazooException):
"""Raised when the kazoo client stopped (and thus not connected)"""
class ConnectionDropped(KazooException):
"""Internal error for jumping out of loops"""
class LockTimeout(KazooException):
"""Raised if failed to acquire a lock.
.. versionadded:: 1.1
"""
class WriterNotClosedException(KazooException):
"""Raised if the writer is unable to stop closing when requested.
.. versionadded:: 1.2
"""
def _invalid_error_code():
raise RuntimeError('Invalid error code')
EXCEPTIONS = defaultdict(_invalid_error_code)
def _zookeeper_exception(code):
def decorator(klass):
def create(*args, **kwargs):
return klass(args, kwargs)
EXCEPTIONS[code] = create
klass.code = code
return klass
return decorator
@_zookeeper_exception(0)
class RolledBackError(ZookeeperError):
pass
@_zookeeper_exception(-1)
class SystemZookeeperError(ZookeeperError):
pass
@_zookeeper_exception(-2)
class RuntimeInconsistency(ZookeeperError):
pass
@_zookeeper_exception(-3)
class DataInconsistency(ZookeeperError):
pass
@_zookeeper_exception(-4)
class ConnectionLoss(ZookeeperError):
pass
@_zookeeper_exception(-5)
class MarshallingError(ZookeeperError):
pass
@_zookeeper_exception(-6)
class UnimplementedError(ZookeeperError):
pass
@_zookeeper_exception(-7)
class OperationTimeoutError(ZookeeperError):
pass
@_zookeeper_exception(-8)
class BadArgumentsError(ZookeeperError):
pass
@_zookeeper_exception(-13)
class NewConfigNoQuorumError(ZookeeperError):
pass
@_zookeeper_exception(-14)
class ReconfigInProcessError(ZookeeperError):
pass
@_zookeeper_exception(-100)
class APIError(ZookeeperError):
pass
@_zookeeper_exception(-101)
class NoNodeError(ZookeeperError):
pass
@_zookeeper_exception(-102)
class NoAuthError(ZookeeperError):
pass
@_zookeeper_exception(-103)
class BadVersionError(ZookeeperError):
pass
@_zookeeper_exception(-108)
class NoChildrenForEphemeralsError(ZookeeperError):
pass
@_zookeeper_exception(-110)
class NodeExistsError(ZookeeperError):
pass
@_zookeeper_exception(-111)
class NotEmptyError(ZookeeperError):
pass
@_zookeeper_exception(-112)
class SessionExpiredError(ZookeeperError):
pass
@_zookeeper_exception(-113)
class InvalidCallbackError(ZookeeperError):
pass
@_zookeeper_exception(-114)
class InvalidACLError(ZookeeperError):
pass
@_zookeeper_exception(-115)
class AuthFailedError(ZookeeperError):
pass
@_zookeeper_exception(-118)
class SessionMovedError(ZookeeperError):
pass
@_zookeeper_exception(-119)
class NotReadOnlyCallError(ZookeeperError):
"""An API call that is not read-only was used while connected to
a read-only server"""
class ConnectionClosedError(SessionExpiredError):
"""Connection is closed"""
# BW Compat aliases for C lib style exceptions
ConnectionLossException = ConnectionLoss
MarshallingErrorException = MarshallingError
SystemErrorException = SystemZookeeperError
RuntimeInconsistencyException = RuntimeInconsistency
DataInconsistencyException = DataInconsistency
UnimplementedException = UnimplementedError
OperationTimeoutException = OperationTimeoutError
BadArgumentsException = BadArgumentsError
ApiErrorException = APIError
NoNodeException = NoNodeError
NoAuthException = NoAuthError
BadVersionException = BadVersionError
NoChildrenForEphemeralsException = NoChildrenForEphemeralsError
NodeExistsException = NodeExistsError
InvalidACLException = InvalidACLError
AuthFailedException = AuthFailedError
NotEmptyException = NotEmptyError
SessionExpiredException = SessionExpiredError
InvalidCallbackException = InvalidCallbackError
|