From 65cb7cfde651ceeb2607027d6168b8693209f55c Mon Sep 17 00:00:00 2001 From: Stuart Longland Date: Sat, 10 Jun 2023 11:03:42 +1000 Subject: [PATCH] mqtt.protocol.handler: Use `exc_info` to emit exception not `%s` The former emits the stack trace, which greatly helps in identifying _WHERE_ an exception is raised, not just WHAT the exception is. --- amqtt/mqtt/protocol/handler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/amqtt/mqtt/protocol/handler.py b/amqtt/mqtt/protocol/handler.py index bb6d4133..eb9875c1 100644 --- a/amqtt/mqtt/protocol/handler.py +++ b/amqtt/mqtt/protocol/handler.py @@ -530,8 +530,8 @@ async def _send_packet(self, packet): await self.handle_connection_closed() except asyncio.CancelledError: raise - except Exception as e: - self.logger.warning("Unhandled exception: %s" % e) + except: + self.logger.warning("Unhandled exception", exc_info=True) raise async def mqtt_deliver_next_message(self):