Debian Codegraph @

pamqp/exceptions.py

raw
1 # Auto-generated, do not edit this file.
2
3
4 class PAMQPException(Exception):
5 """Base exception for all pamqp specific exceptions."""
6
7
8 class UnmarshalingException(PAMQPException):
9 """Raised when a frame is not able to be unmarshaled."""
10
11 def __str__(self) -> str: # pragma: nocover
12 return f'Could not unmarshal {self.args[0]} frame: {self.args[1]}'
13
14
15 class AMQPError(PAMQPException):
16 """Base exception for all AMQP errors."""
17
18
19 class AMQPSoftError(AMQPError):
20 """Base exception for all AMQP soft errors."""
21
22
23 class AMQPHardError(AMQPError):
24 """Base exception for all AMQP hard errors."""
25
26
27 class AMQPContentTooLarge(AMQPSoftError):
28 """
29 The client attempted to transfer content larger than the server could
30 accept at the present time. The client may retry at a later time.
31
32 """
33
34 name = 'CONTENT-TOO-LARGE'
35 value = 311
36
37
38 class AMQPNoRoute(AMQPSoftError):
39 """
40 Returned when RabbitMQ sends back with 'basic.return' when a 'mandatory'
41 message cannot be delivered to any queue.
42
43 """
44
45 name = 'NO-ROUTE'
46 value = 312
47
48
49 class AMQPNoConsumers(AMQPSoftError):
50 """
51 When the exchange cannot deliver to a consumer when the immediate flag is
52 set. As a result of pending data on the queue or the absence of any
53 consumers of the queue.
54
55 """
56
57 name = 'NO-CONSUMERS'
58 value = 313
59
60
61 class AMQPAccessRefused(AMQPSoftError):
62 """
63 The client attempted to work with a server entity to which it has no access
64 due to security settings.
65
66 """
67
68 name = 'ACCESS-REFUSED'
69 value = 403
70
71
72 class AMQPNotFound(AMQPSoftError):
73 """
74 The client attempted to work with a server entity that does not exist.
75
76 """
77
78 name = 'NOT-FOUND'
79 value = 404
80
81
82 class AMQPResourceLocked(AMQPSoftError):
83 """
84 The client attempted to work with a server entity to which it has no access
85 because another client is working with it.
86
87 """
88
89 name = 'RESOURCE-LOCKED'
90 value = 405
91
92
93 class AMQPPreconditionFailed(AMQPSoftError):
94 """
95 The client requested a method that was not allowed because some
96 precondition failed.
97
98 """
99
100 name = 'PRECONDITION-FAILED'
101 value = 406
102
103
104 class AMQPConnectionForced(AMQPHardError):
105 """
106 An operator intervened to close the connection for some reason. The client
107 may retry at some later date.
108
109 """
110
111 name = 'CONNECTION-FORCED'
112 value = 320
113
114
115 class AMQPInvalidPath(AMQPHardError):
116 """
117 The client tried to work with an unknown virtual host.
118
119 """
120
121 name = 'INVALID-PATH'
122 value = 402
123
124
125 class AMQPFrameError(AMQPHardError):
126 """
127 The sender sent a malformed frame that the recipient could not decode. This
128 strongly implies a programming error in the sending peer.
129
130 """
131
132 name = 'FRAME-ERROR'
133 value = 501
134
135
136 class AMQPSyntaxError(AMQPHardError):
137 """
138 The sender sent a frame that contained illegal values for one or more
139 fields. This strongly implies a programming error in the sending peer.
140
141 """
142
143 name = 'SYNTAX-ERROR'
144 value = 502
145
146
147 class AMQPCommandInvalid(AMQPHardError):
148 """
149 The client sent an invalid sequence of frames, attempting to perform an
150 operation that was considered invalid by the server. This usually implies a
151 programming error in the client.
152
153 """
154
155 name = 'COMMAND-INVALID'
156 value = 503
157
158
159 class AMQPChannelError(AMQPHardError):
160 """
161 The client attempted to work with a channel that had not been correctly
162 opened. This most likely indicates a fault in the client layer.
163
164 """
165
166 name = 'CHANNEL-ERROR'
167 value = 504
168
169
170 class AMQPUnexpectedFrame(AMQPHardError):
171 """
172 The peer sent a frame that was not expected, usually in the context of a
173 content header and body. This strongly indicates a fault in the peer's
174 content processing.
175
176 """
177
178 name = 'UNEXPECTED-FRAME'
179 value = 505
180
181
182 class AMQPResourceError(AMQPHardError):
183 """
184 The server could not complete the method because it lacked sufficient
185 resources. This may be due to the client creating too many of some type of
186 entity.
187
188 """
189
190 name = 'RESOURCE-ERROR'
191 value = 506
192
193
194 class AMQPNotAllowed(AMQPHardError):
195 """
196 The client tried to work with some entity in a manner that is prohibited by
197 the server, due to security settings or by some other criteria.
198
199 """
200
201 name = 'NOT-ALLOWED'
202 value = 530
203
204
205 class AMQPNotImplemented(AMQPHardError):
206 """
207 The client tried to use functionality that is not implemented in the
208 server.
209
210 """
211
212 name = 'NOT-IMPLEMENTED'
213 value = 540
214
215
216 class AMQPInternalError(AMQPHardError):
217 """
218 The server could not complete the method because of an internal error. The
219 server may require intervention by an operator in order to resume normal
220 operations.
221
222 """
223
224 name = 'INTERNAL-ERROR'
225 value = 541
226
227
228 # AMQP Error code to class mapping
229 CLASS_MAPPING = {
230 311: AMQPContentTooLarge,
231 312: AMQPNoRoute,
232 313: AMQPNoConsumers,
233 403: AMQPAccessRefused,
234 404: AMQPNotFound,
235 405: AMQPResourceLocked,
236 406: AMQPPreconditionFailed,
237 320: AMQPConnectionForced,
238 402: AMQPInvalidPath,
239 501: AMQPFrameError,
240 502: AMQPSyntaxError,
241 503: AMQPCommandInvalid,
242 504: AMQPChannelError,
243 505: AMQPUnexpectedFrame,
244 506: AMQPResourceError,
245 530: AMQPNotAllowed,
246 540: AMQPNotImplemented,
247 541: AMQPInternalError,
248 }