How to use the aiormq.exceptions.AMQPError function in aiormq

To help you get started, we’ve selected a few aiormq examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mosquito / aiormq / aiormq / exceptions.py View on Github external
)


class DuplicateConsumerTag(ChannelClosed):
    reason = "The consumer tag specified already exists for this channel: %s"


class ProtocolSyntaxError(AMQPError):
    reason = "An unspecified protocol syntax error occurred"


class InvalidFrameError(ProtocolSyntaxError):
    reason = "Invalid frame received: %r"


class MethodNotImplemented(AMQPError):
    pass


class DeliveryError(AMQPError):
    __slots__ = "message", "frame"

    reason = "Error when delivery message %r, frame %r"

    def __init__(self, message: DeliveredMessage, frame: spec.Frame, *args):
        self.message = message
        self.frame = frame

        super().__init__(self.message, self.frame)


class PublishError(DeliveryError):
github mosquito / aiormq / aiormq / exceptions.py View on Github external
reason = "The consumer tag specified already exists for this channel: %s"


class ProtocolSyntaxError(AMQPError):
    reason = "An unspecified protocol syntax error occurred"


class InvalidFrameError(ProtocolSyntaxError):
    reason = "Invalid frame received: %r"


class MethodNotImplemented(AMQPError):
    pass


class DeliveryError(AMQPError):
    __slots__ = "message", "frame"

    reason = "Error when delivery message %r, frame %r"

    def __init__(self, message: DeliveredMessage, frame: spec.Frame, *args):
        self.message = message
        self.frame = frame

        super().__init__(self.message, self.frame)


class PublishError(DeliveryError):
    reason = "%r for routing key %r"

    def __init__(self, message: DeliveredMessage, frame: spec.Frame, *args):
        assert isinstance(message.delivery, spec.Basic.Return)
github mosquito / aiormq / aiormq / exceptions.py View on Github external
from pamqp import specification as spec
from .types import DeliveredMessage


class AMQPError(Exception):
    reason = "An unspecified AMQP error has occurred: %s"

    def __repr__(self):
        return "<%s: %s>" % (self.__class__.__name__, self.reason % self.args)


# Backward compatibility
AMQPException = AMQPError


class AMQPConnectionError(AMQPError):
    reason = "Connection can not be opened"


class IncompatibleProtocolError(AMQPConnectionError):
    reason = "The protocol returned by the server is not supported"


class AuthenticationError(AMQPConnectionError):
    reason = (
        "Server and client could not negotiate use of the "
        "authentication mechanisms. Server supports only %r, "
        "but client supports only %r."
    )


class ProbableAuthenticationError(AMQPConnectionError):
github mosquito / aio-pika / aio_pika / exceptions.py View on Github external
InvalidFrameError,
    MethodNotImplemented,
    ProbableAuthenticationError,
    ProtocolSyntaxError,
    ChannelPreconditionFailed,
    ChannelNotFoundEntity
)

PAMQP_EXCEPTIONS = (
    pamqp.exceptions.PAMQPException,
) + tuple(pamqp.specification.ERRORS.values())

CONNECTION_EXCEPTIONS = (
    RuntimeError,
    ConnectionError,
    AMQPError,
) + PAMQP_EXCEPTIONS


class MessageProcessError(AMQPError):
    pass


class QueueEmpty(AMQPError, asyncio.QueueEmpty):
    pass


__all__ = (
    'AMQPChannelError',
    'AMQPConnectionError',
    'AMQPError',
    'AMQPException',
github mosquito / aiormq / aiormq / exceptions.py View on Github external
"with it: %r"
    )


class ChannelPreconditionFailed(ChannelClosed):
    reason = (
        "The client requested a method that was not allowed because "
        "some precondition failed: %r"
    )


class DuplicateConsumerTag(ChannelClosed):
    reason = "The consumer tag specified already exists for this channel: %s"


class ProtocolSyntaxError(AMQPError):
    reason = "An unspecified protocol syntax error occurred"


class InvalidFrameError(ProtocolSyntaxError):
    reason = "Invalid frame received: %r"


class MethodNotImplemented(AMQPError):
    pass


class DeliveryError(AMQPError):
    __slots__ = "message", "frame"

    reason = "Error when delivery message %r, frame %r"
github mosquito / aio-pika / aio_pika / exceptions.py View on Github external
ChannelPreconditionFailed,
    ChannelNotFoundEntity
)

PAMQP_EXCEPTIONS = (
    pamqp.exceptions.PAMQPException,
) + tuple(pamqp.specification.ERRORS.values())

CONNECTION_EXCEPTIONS = (
    RuntimeError,
    ConnectionError,
    AMQPError,
) + PAMQP_EXCEPTIONS


class MessageProcessError(AMQPError):
    pass


class QueueEmpty(AMQPError, asyncio.QueueEmpty):
    pass


__all__ = (
    'AMQPChannelError',
    'AMQPConnectionError',
    'AMQPError',
    'AMQPException',
    'AuthenticationError',
    'ChannelClosed',
    'ConnectionClosed',
    'DeliveryError',
github mosquito / aio-pika / aio_pika / exceptions.py View on Github external
PAMQP_EXCEPTIONS = (
    pamqp.exceptions.PAMQPException,
) + tuple(pamqp.specification.ERRORS.values())

CONNECTION_EXCEPTIONS = (
    RuntimeError,
    ConnectionError,
    AMQPError,
) + PAMQP_EXCEPTIONS


class MessageProcessError(AMQPError):
    pass


class QueueEmpty(AMQPError, asyncio.QueueEmpty):
    pass


__all__ = (
    'AMQPChannelError',
    'AMQPConnectionError',
    'AMQPError',
    'AMQPException',
    'AuthenticationError',
    'ChannelClosed',
    'ConnectionClosed',
    'DeliveryError',
    'PublishError',
    'DuplicateConsumerTag',
    'IncompatibleProtocolError',
    'InvalidFrameError',
github mosquito / aiormq / aiormq / exceptions.py View on Github external
class ConnectionNotImplemented(ConnectionClosed):
    reason = (
        "The client tried to use functionality that is "
        "not implemented in the server: %r"
    )


class ConnectionInternalError(ConnectionClosed):
    reason = (
        " 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: %r"
    )


class AMQPChannelError(AMQPError):
    reason = "An unspecified AMQP channel error has occurred"


class ChannelClosed(AMQPChannelError):
    reason = "The channel was closed (%s) %s"


class ChannelAccessRefused(ChannelClosed):
    reason = (
        "The client attempted to work with a server entity to "
        "which it has no access due to security settings: %r"
    )


class ChannelNotFoundEntity(ChannelClosed):
    reason = (