From b1d97465e38e9e42a02941d2bfe8976aaf129146 Mon Sep 17 00:00:00 2001 From: Known Black Hat <65008967+KnownBlackHat@users.noreply.github.com> Date: Sun, 22 Sep 2024 23:07:40 +0530 Subject: [PATCH] fix: ambiguity in client termination handler (#26) `client/bot` could get closed for various of reasons like some openssl error. So, this pr fixes this and add explicit logging for client termination on Exceptions. --- mr_robot/__main__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mr_robot/__main__.py b/mr_robot/__main__.py index 3da808e..296951e 100644 --- a/mr_robot/__main__.py +++ b/mr_robot/__main__.py @@ -64,6 +64,8 @@ async def main(): await future except asyncio.CancelledError: logger.info("Received signal to terminate bot and event loop") + except Exception as e: + logger.info(f"Client got closed due to: {e}") finally: logger.warning("Closing Client") if not client.is_closed():