How to use the aiormq.exceptions.DeliveryError 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 / channel.py View on Github external
confirmation = self.confirmations.pop(delivery_tag)

        if confirmation is self.Returning:
            return
        elif confirmation.done():  # pragma: nocover
            log.warn(
                "Delivery tag %r confirmed %r was ignored", delivery_tag, frame
            )
            return
        elif isinstance(frame, spec.Basic.Ack):
            confirmation.set_result(frame)
            return

        confirmation.set_exception(
            exc.DeliveryError(None, frame)
        )  # pragma: nocover
github mosquito / aiormq / aiormq / exceptions.py View on Github external
def __init__(self, message: DeliveredMessage, frame: spec.Frame, *args):
        assert isinstance(message.delivery, spec.Basic.Return)

        self.message = message
        self.frame = frame

        super(DeliveryError, self).__init__(
            message.delivery.reply_text, message.delivery.routing_key, *args
        )
github mosquito / aiormq / aiormq / exceptions.py View on Github external
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)

        self.message = message
        self.frame = frame

        super(DeliveryError, self).__init__(
            message.delivery.reply_text, message.delivery.routing_key, *args
        )


class ChannelInvalidStateError(RuntimeError):
    pass