Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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
)
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