/usr/lib/python3/dist-packages/pika/exceptions.py is in python3-pika 0.11.0-1.
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 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | """Pika specific exceptions"""
class AMQPError(Exception):
def __repr__(self):
return 'An unspecified AMQP error has occurred'
class AMQPConnectionError(AMQPError):
def __repr__(self):
if len(self.args) == 1:
if self.args[0] == 1:
return ('No connection could be opened after 1 '
'connection attempt')
elif isinstance(self.args[0], int):
return ('No connection could be opened after %s '
'connection attempts' % self.args[0])
else:
return ('No connection could be opened: %s' % self.args[0])
elif len(self.args) == 2:
return '%s: %s' % (self.args[0], self.args[1])
class IncompatibleProtocolError(AMQPConnectionError):
def __repr__(self):
return ('The protocol returned by the server is not supported: %s' %
(self.args,))
class AuthenticationError(AMQPConnectionError):
def __repr__(self):
return ('Server and client could not negotiate use of the %s '
'authentication mechanism' % self.args[0])
class ProbableAuthenticationError(AMQPConnectionError):
def __repr__(self):
return ('Client was disconnected at a connection stage indicating a '
'probable authentication error: %s' % (self.args,))
class ProbableAccessDeniedError(AMQPConnectionError):
def __repr__(self):
return ('Client was disconnected at a connection stage indicating a '
'probable denial of access to the specified virtual host: %s' %
(self.args,))
class NoFreeChannels(AMQPConnectionError):
def __repr__(self):
return 'The connection has run out of free channels'
class ConnectionClosed(AMQPConnectionError):
def __repr__(self):
if len(self.args) == 2:
return 'The AMQP connection was closed (%s) %s' % (self.args[0],
self.args[1])
else:
return 'The AMQP connection was closed: %s' % (self.args,)
class AMQPChannelError(AMQPError):
def __repr__(self):
return 'An unspecified AMQP channel error has occurred'
class ChannelClosed(AMQPChannelError):
def __repr__(self):
if len(self.args) == 2:
return 'The channel was closed (%s) %s' % (self.args[0],
self.args[1])
else:
return 'The channel was closed: %s' % (self.args,)
class ChannelAlreadyClosing(AMQPChannelError):
"""Raised when `Channel.close` is called while channel is already closing"""
pass
class DuplicateConsumerTag(AMQPChannelError):
def __repr__(self):
return ('The consumer tag specified already exists for this '
'channel: %s' % self.args[0])
class ConsumerCancelled(AMQPChannelError):
def __repr__(self):
return 'Server cancelled consumer'
class UnroutableError(AMQPChannelError):
"""Exception containing one or more unroutable messages returned by broker
via Basic.Return.
Used by BlockingChannel.
In publisher-acknowledgements mode, this is raised upon receipt of Basic.Ack
from broker; in the event of Basic.Nack from broker, `NackError` is raised
instead
"""
def __init__(self, messages):
"""
:param messages: sequence of returned unroutable messages
:type messages: sequence of `blocking_connection.ReturnedMessage`
objects
"""
super(UnroutableError, self).__init__(
"%s unroutable message(s) returned" % (len(messages)))
self.messages = messages
def __repr__(self):
return '%s: %i unroutable messages returned by broker' % (
self.__class__.__name__, len(self.messages))
class NackError(AMQPChannelError):
"""This exception is raised when a message published in
publisher-acknowledgements mode is Nack'ed by the broker.
Used by BlockingChannel.
"""
def __init__(self, messages):
"""
:param messages: sequence of returned unroutable messages
:type messages: sequence of `blocking_connection.ReturnedMessage`
objects
"""
super(NackError, self).__init__(
"%s message(s) NACKed" % (len(messages)))
self.messages = messages
def __repr__(self):
return '%s: %i unroutable messages returned by broker' % (
self.__class__.__name__, len(self.messages))
class InvalidChannelNumber(AMQPError):
def __repr__(self):
return 'An invalid channel number has been specified: %s' % self.args[0]
class ProtocolSyntaxError(AMQPError):
def __repr__(self):
return 'An unspecified protocol syntax error occurred'
class UnexpectedFrameError(ProtocolSyntaxError):
def __repr__(self):
return 'Received a frame out of sequence: %r' % self.args[0]
class ProtocolVersionMismatch(ProtocolSyntaxError):
def __repr__(self):
return 'Protocol versions did not match: %r vs %r' % (self.args[0],
self.args[1])
class BodyTooLongError(ProtocolSyntaxError):
def __repr__(self):
return ('Received too many bytes for a message delivery: '
'Received %i, expected %i' % (self.args[0], self.args[1]))
class InvalidFrameError(ProtocolSyntaxError):
def __repr__(self):
return 'Invalid frame received: %r' % self.args[0]
class InvalidFieldTypeException(ProtocolSyntaxError):
def __repr__(self):
return 'Unsupported field kind %s' % self.args[0]
class UnsupportedAMQPFieldException(ProtocolSyntaxError):
def __repr__(self):
return 'Unsupported field kind %s' % type(self.args[1])
class UnspportedAMQPFieldException(UnsupportedAMQPFieldException):
"""Deprecated version of UnsupportedAMQPFieldException"""
class MethodNotImplemented(AMQPError):
pass
class ChannelError(Exception):
def __repr__(self):
return 'An unspecified error occurred with the Channel'
class InvalidMinimumFrameSize(ProtocolSyntaxError):
""" DEPRECATED; pika.connection.Parameters.frame_max property setter now
raises the standard `ValueError` exception when the value is out of bounds.
"""
def __repr__(self):
return 'AMQP Minimum Frame Size is 4096 Bytes'
class InvalidMaximumFrameSize(ProtocolSyntaxError):
""" DEPRECATED; pika.connection.Parameters.frame_max property setter now
raises the standard `ValueError` exception when the value is out of bounds.
"""
def __repr__(self):
return 'AMQP Maximum Frame Size is 131072 Bytes'
class RecursionError(Exception):
"""The requested operation would result in unsupported recursion or
reentrancy.
Used by BlockingConnection/BlockingChannel
"""
class ShortStringTooLong(AMQPError):
def __repr__(self):
return ('AMQP Short String can contain up to 255 bytes: '
'%.300s' % self.args[0])
class DuplicateGetOkCallback(ChannelError):
def __repr__(self):
return ('basic_get can only be called again after the callback for the'
'previous basic_get is executed')
|