rabbitpy contains two types of exceptions, exceptions that are specific to rabbitpy and exceptions that are raises as the result of a Channel or Connection closure from RabbitMQ. These exceptions will be raised to let you know when you have performed an action like redeclared a pre-existing queue with different values. Consider the following example:

>>> import rabbitpy
>>> with rabbitpy.Connection() as connection:
...     with connection.channel() as channel:
...         queue = rabbitpy.Queue(channel, 'exception-test')
...         queue.durable = True
...         queue.declare()
...         queue.durable = False
...         queue.declare()
Traceback (most recent call last):
  File "<stdin>", line 7, in <module>
  File "rabbitpy/connection.py", line 131, in __exit__
  File "rabbitpy/connection.py", line 469, in _shutdown_connection
  File "rabbitpy/channel.py", line 124, in close
    super(Channel, self).close()
  File "rabbitpy/base.py", line 185, in close
  File "rabbitpy/base.py", line 199, in rpc
  File "rabbitpy/base.py", line 311, in _write_frame
    raise exception
rabbitpy.exceptions.AMQPPreconditionFailed: <pamqp.specification.Channel.Close object at 0x10e86bd50>

In this example, the channel that was created on the second line was closed and RabbitMQ is raising the AMQPPreconditionFailed exception via RPC sent to your application using the AMQP Channel.Close method.

Exceptions that may be raised by rabbitpy during use

exception rabbitpy.exceptions.AMQPAccessRefused[source]

The client attempted to work with a server entity to which it has no access due to security settings.

exception rabbitpy.exceptions.AMQPChannelError[source]

The client attempted to work with a channel that had not been correctly opened. This most likely indicates a fault in the client layer.

exception rabbitpy.exceptions.AMQPCommandInvalid[source]

The client sent an invalid sequence of frames, attempting to perform an operation that was considered invalid by the server. This usually implies a programming error in the client.

exception rabbitpy.exceptions.AMQPConnectionForced[source]

An operator intervened to close the connection for some reason. The client may retry at some later date.

exception rabbitpy.exceptions.AMQPContentTooLarge[source]

The client attempted to transfer content larger than the server could accept at the present time. The client may retry at a later time.

exception rabbitpy.exceptions.AMQPException[source]

Base exception of all AMQP exceptions.

exception rabbitpy.exceptions.AMQPFrameError[source]

The sender sent a malformed frame that the recipient could not decode. This strongly implies a programming error in the sending peer.

exception rabbitpy.exceptions.AMQPInternalError[source]

The server could not complete the method because of an internal error. The server may require intervention by an operator in order to resume normal operations.

exception rabbitpy.exceptions.AMQPInvalidPath[source]

The client tried to work with an unknown virtual host.

exception rabbitpy.exceptions.AMQPNoConsumers[source]

When the exchange cannot deliver to a consumer when the immediate flag is set. As a result of pending data on the queue or the absence of any consumers of the queue.

exception rabbitpy.exceptions.AMQPNoRoute[source]

Undocumented AMQP Soft Error

exception rabbitpy.exceptions.AMQPNotAllowed[source]

The client tried to work with some entity in a manner that is prohibited by the server, due to security settings or by some other criteria.

exception rabbitpy.exceptions.AMQPNotFound[source]

The client attempted to work with a server entity that does not exist.

exception rabbitpy.exceptions.AMQPNotImplemented[source]

The client tried to use functionality that is not implemented in the server.

exception rabbitpy.exceptions.AMQPPreconditionFailed[source]

The client requested a method that was not allowed because some precondition failed.

exception rabbitpy.exceptions.AMQPResourceError[source]

The server could not complete the method because it lacked sufficient resources. This may be due to the client creating too many of some type of entity.

exception rabbitpy.exceptions.AMQPResourceLocked[source]

The client attempted to work with a server entity to which it has no access because another client is working with it.

exception rabbitpy.exceptions.AMQPSyntaxError[source]

The sender sent a frame that contained illegal values for one or more fields. This strongly implies a programming error in the sending peer.

exception rabbitpy.exceptions.AMQPUnexpectedFrame[source]

The peer sent a frame that was not expected, usually in the context of a content header and body. This strongly indicates a fault in the peer’s content processing.

exception rabbitpy.exceptions.ActionException[source]

Raised when an action is taken on a Rabbitpy object that is not supported due to the state of the object. An example would be trying to ack a Message object when the message object was locally created and not sent by RabbitMQ via an AMQP Basic.Get or Basic.Consume.

exception rabbitpy.exceptions.ChannelClosedException[source]

Raised when an action is attempted on a channel that is closed.

exception rabbitpy.exceptions.ConnectionClosed[source]

Raised if a connection.close() is invoked when the connection is not open.

exception rabbitpy.exceptions.ConnectionException[source]

Raised when Rabbitpy can not connect to the specified server and if a connection fails and the RabbitMQ version does not support the authentication_failure_close feature added in RabbitMQ 3.2.

exception rabbitpy.exceptions.ConnectionResetException[source]

Raised if the socket level connection was reset. This can happen due to the loss of network connection or socket timeout, or more than 2 missed heartbeat intervals if heartbeats are enabled.

exception rabbitpy.exceptions.MessageReturnedException[source]

Raised if the RabbitMQ sends a message back to a publisher via the Basic.Return RPC call.

exception rabbitpy.exceptions.NoActiveTransactionError[source]

Raised when a transaction method is issued but the transaction has not been initiated.

exception rabbitpy.exceptions.NotConsumingError[source]

Raised Queue.cancel_consumer() is invoked but the queue is not actively consuming.

exception rabbitpy.exceptions.NotSupportedError[source]

Raised when a feature is requested that is not supported by the RabbitMQ server.

exception rabbitpy.exceptions.RabbitpyException[source]

Base exception of all rabbitpy exceptions.

exception rabbitpy.exceptions.RemoteCancellationException[source]

Raised if RabbitMQ cancels an active consumer

exception rabbitpy.exceptions.RemoteClosedChannelException[source]

Raised if RabbitMQ closes the channel and the reply_code in the Channel.Close RPC request does not have a mapped exception in Rabbitpy.

exception rabbitpy.exceptions.RemoteClosedException[source]

Raised if RabbitMQ closes the connection and the reply_code in the Connection.Close RPC request does not have a mapped exception in Rabbitpy.

exception rabbitpy.exceptions.TooManyChannelsError[source]

Raised if an application attempts to create a channel, exceeding the maximum number of channels (MAXINT or 2,147,483,647) available for a single connection. Note that each time a channel object is created, it will take a new channel id. If you create and destroy 2,147,483,648 channels, this exception will be raised.

exception rabbitpy.exceptions.UnexpectedResponseError[source]

Raised when an RPC call is made to RabbitMQ but the response it sent back is not recognized.