|
1 | 1 | """Kazoo Exceptions"""
|
| 2 | + |
2 | 3 | from collections import defaultdict
|
3 | 4 |
|
4 | 5 |
|
@@ -66,130 +67,194 @@ def decorator(klass):
|
66 | 67 | return decorator
|
67 | 68 |
|
68 | 69 |
|
| 70 | +# Pulled from zookeeper-server/src/main/java/org/apache/zookeeper/ |
| 71 | +# KeeperException.java in the Java Zookeeper server source code. |
| 72 | + |
| 73 | + |
69 | 74 | @_zookeeper_exception(0)
|
70 | 75 | class RolledBackError(ZookeeperError):
|
71 | 76 | pass
|
72 | 77 |
|
73 | 78 |
|
74 | 79 | @_zookeeper_exception(-1)
|
75 | 80 | class SystemZookeeperError(ZookeeperError):
|
76 |
| - pass |
| 81 | + """System and server-side errors. |
| 82 | + This is never thrown by the server, it shouldn't be used other than to |
| 83 | + indicate a range. Specifically error codes greater than this value, but |
| 84 | + lesser than APIError, are system errors. |
| 85 | + """ |
77 | 86 |
|
78 | 87 |
|
79 | 88 | @_zookeeper_exception(-2)
|
80 | 89 | class RuntimeInconsistency(ZookeeperError):
|
81 |
| - pass |
| 90 | + """A runtime inconsistency was found.""" |
82 | 91 |
|
83 | 92 |
|
84 | 93 | @_zookeeper_exception(-3)
|
85 | 94 | class DataInconsistency(ZookeeperError):
|
86 |
| - pass |
| 95 | + """A data inconsistency was found.""" |
87 | 96 |
|
88 | 97 |
|
89 | 98 | @_zookeeper_exception(-4)
|
90 | 99 | class ConnectionLoss(ZookeeperError):
|
91 |
| - pass |
| 100 | + """Connection to the server has been lost.""" |
92 | 101 |
|
93 | 102 |
|
94 | 103 | @_zookeeper_exception(-5)
|
95 | 104 | class MarshallingError(ZookeeperError):
|
96 |
| - pass |
| 105 | + """Error while marshalling or unmarshalling data.""" |
97 | 106 |
|
98 | 107 |
|
99 | 108 | @_zookeeper_exception(-6)
|
100 | 109 | class UnimplementedError(ZookeeperError):
|
101 |
| - pass |
| 110 | + """Operation is unimplemented.""" |
102 | 111 |
|
103 | 112 |
|
104 | 113 | @_zookeeper_exception(-7)
|
105 | 114 | class OperationTimeoutError(ZookeeperError):
|
106 |
| - pass |
| 115 | + """Operation timeout.""" |
107 | 116 |
|
108 | 117 |
|
109 | 118 | @_zookeeper_exception(-8)
|
110 | 119 | class BadArgumentsError(ZookeeperError):
|
111 |
| - pass |
| 120 | + """Invalid arguments.""" |
| 121 | + |
| 122 | + |
| 123 | +@_zookeeper_exception(-12) |
| 124 | +class UnknownSessionError(ZookeeperError): |
| 125 | + """Unknown session (internal server use only).""" |
112 | 126 |
|
113 | 127 |
|
114 | 128 | @_zookeeper_exception(-13)
|
115 | 129 | class NewConfigNoQuorumError(ZookeeperError):
|
116 |
| - pass |
| 130 | + """No quorum of new config is connected and up-to-date with the leader of |
| 131 | + last commmitted config - try invoking reconfiguration after new servers are |
| 132 | + connected and synced. |
| 133 | + """ |
117 | 134 |
|
118 | 135 |
|
119 | 136 | @_zookeeper_exception(-14)
|
120 | 137 | class ReconfigInProcessError(ZookeeperError):
|
121 |
| - pass |
| 138 | + """Another reconfiguration is in progress -- concurrent reconfigs not |
| 139 | + supported (yet). |
| 140 | + """ |
122 | 141 |
|
123 | 142 |
|
124 | 143 | @_zookeeper_exception(-100)
|
125 | 144 | class APIError(ZookeeperError):
|
126 |
| - pass |
| 145 | + """API errors. |
| 146 | + This is never thrown by the server, it shouldn't be used other than to |
| 147 | + indicate a range. Specifically error codes greater than this value are API |
| 148 | + errors (while values less than this indicate a system error. |
| 149 | + """ |
127 | 150 |
|
128 | 151 |
|
129 | 152 | @_zookeeper_exception(-101)
|
130 | 153 | class NoNodeError(ZookeeperError):
|
131 |
| - pass |
| 154 | + """Node does not exist.""" |
132 | 155 |
|
133 | 156 |
|
134 | 157 | @_zookeeper_exception(-102)
|
135 | 158 | class NoAuthError(ZookeeperError):
|
136 |
| - pass |
| 159 | + """Not authenticated.""" |
137 | 160 |
|
138 | 161 |
|
139 | 162 | @_zookeeper_exception(-103)
|
140 | 163 | class BadVersionError(ZookeeperError):
|
141 |
| - pass |
| 164 | + """Version conflict. In case of reconfiguration: reconfig requested from |
| 165 | + config version X but last seen config has a different version Y. |
| 166 | + """ |
142 | 167 |
|
143 | 168 |
|
144 | 169 | @_zookeeper_exception(-108)
|
145 | 170 | class NoChildrenForEphemeralsError(ZookeeperError):
|
146 |
| - pass |
| 171 | + """Ephemeral nodes may not have children.""" |
147 | 172 |
|
148 | 173 |
|
149 | 174 | @_zookeeper_exception(-110)
|
150 | 175 | class NodeExistsError(ZookeeperError):
|
151 |
| - pass |
| 176 | + """The node already exists.""" |
152 | 177 |
|
153 | 178 |
|
154 | 179 | @_zookeeper_exception(-111)
|
155 | 180 | class NotEmptyError(ZookeeperError):
|
156 |
| - pass |
| 181 | + """The node has children.""" |
157 | 182 |
|
158 | 183 |
|
159 | 184 | @_zookeeper_exception(-112)
|
160 | 185 | class SessionExpiredError(ZookeeperError):
|
161 |
| - pass |
| 186 | + """The session has been expired by the server.""" |
162 | 187 |
|
163 | 188 |
|
164 | 189 | @_zookeeper_exception(-113)
|
165 | 190 | class InvalidCallbackError(ZookeeperError):
|
166 |
| - pass |
| 191 | + """Invalid callback specified.""" |
167 | 192 |
|
168 | 193 |
|
169 | 194 | @_zookeeper_exception(-114)
|
170 | 195 | class InvalidACLError(ZookeeperError):
|
171 |
| - pass |
| 196 | + """Invalid ACL specified""" |
172 | 197 |
|
173 | 198 |
|
174 | 199 | @_zookeeper_exception(-115)
|
175 | 200 | class AuthFailedError(ZookeeperError):
|
176 |
| - pass |
| 201 | + """Client authentication failed.""" |
177 | 202 |
|
178 | 203 |
|
179 | 204 | @_zookeeper_exception(-118)
|
180 | 205 | class SessionMovedError(ZookeeperError):
|
181 |
| - pass |
| 206 | + """Session moved to another server, so operation is ignored.""" |
182 | 207 |
|
183 | 208 |
|
184 | 209 | @_zookeeper_exception(-119)
|
185 | 210 | class NotReadOnlyCallError(ZookeeperError):
|
186 |
| - """An API call that is not read-only was used while connected to |
187 |
| - a read-only server""" |
| 211 | + """An API call that is not read-only was used while connected to a |
| 212 | + read-only server. |
| 213 | + """ |
| 214 | + |
| 215 | + |
| 216 | +@_zookeeper_exception(-120) |
| 217 | +class EphemeralOnLocalSessionError(ZookeeperError): |
| 218 | + """Attempt to create ephemeral node on a local session.""" |
| 219 | + |
| 220 | + |
| 221 | +@_zookeeper_exception(-121) |
| 222 | +class NoWatcherError(ZookeeperError): |
| 223 | + """Attempts to remove a non-existing watcher.""" |
| 224 | + |
| 225 | + |
| 226 | +@_zookeeper_exception(-122) |
| 227 | +class RequestTimeoutError(ZookeeperError): |
| 228 | + """Request not completed within max allowed time.""" |
| 229 | + |
| 230 | + |
| 231 | +@_zookeeper_exception(-123) |
| 232 | +class ReconfigDisabledError(ZookeeperError): |
| 233 | + """Attempts to perform a reconfiguration operation when reconfiguration |
| 234 | + feature is disabled. |
| 235 | + """ |
| 236 | + |
| 237 | + |
| 238 | +@_zookeeper_exception(-124) |
| 239 | +class SessionClosedRequireSaslError(ZookeeperError): |
| 240 | + """The session has been closed by server because server requires client to |
| 241 | + do authentication with configured authentication scheme at the server, but |
| 242 | + client is not configured with required authentication scheme or configured |
| 243 | + but authentication failed (i.e. wrong credential used.). |
| 244 | + """ |
188 | 245 |
|
189 | 246 |
|
190 | 247 | @_zookeeper_exception(-125)
|
191 | 248 | class QuotaExceededError(ZookeeperError):
|
192 |
| - """Exceeded the quota that was set on the path""" |
| 249 | + """Exceeded the quota that was set on the path.""" |
| 250 | + |
| 251 | + |
| 252 | +@_zookeeper_exception(-127) |
| 253 | +class ThrottledOpError(ZookeeperError): |
| 254 | + """Operation was throttled and not executed at all. This error code |
| 255 | + indicates that zookeeper server is under heavy load and can't process |
| 256 | + incoming requests at full speed; please retry with back off. |
| 257 | + """ |
193 | 258 |
|
194 | 259 |
|
195 | 260 | class ConnectionClosedError(SessionExpiredError):
|
|
0 commit comments