From bbf013385ab75c5c02cc0f39f7db2896bb98653a Mon Sep 17 00:00:00 2001 From: Viktor Seifert Date: Mon, 1 Aug 2022 13:17:01 +0200 Subject: [PATCH] RED-4653: Corrected exception block to not swallow exceptions --- pyinfra/queue/queue_manager.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pyinfra/queue/queue_manager.py b/pyinfra/queue/queue_manager.py index c961de9..7762ffc 100644 --- a/pyinfra/queue/queue_manager.py +++ b/pyinfra/queue/queue_manager.py @@ -67,14 +67,16 @@ class QueueManager(object): self.logger.info("Consuming from queue") self._consumer_token = None + try: self._consumer_token = self._channel.basic_consume(self._input_queue, callback) self.logger.info(f"Registered with consumer-tag: {self._consumer_token}") self._channel.start_consuming() - except Exception as ex: + except Exception: self.logger.warning( - f"An unexpected exception occurred while consuming messages. Consuming will stop.\n{ex}" + f"An unexpected exception occurred while consuming messages. Consuming will stop." ) + raise finally: self.stop_consuming()