From 1e6655a71526ef728ffddc60e7d7e942587380f1 Mon Sep 17 00:00:00 2001 From: Balakrishnan Balasubramanian Date: Thu, 22 Jun 2023 00:31:05 -0400 Subject: [PATCH] pop3 catch and log exceptions --- mail4one/pop3.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mail4one/pop3.py b/mail4one/pop3.py index 47e6f8e..e514fe9 100644 --- a/mail4one/pop3.py +++ b/mail4one/pop3.py @@ -351,10 +351,13 @@ def make_pop_server_callback(mails_path: Path, users: list[User], State(reader=reader, writer=writer, ip=ip, req_id=scfg.next_id())) logger.info(f"Got pop server callback") try: - return await asyncio.wait_for(start_session(), timeout_seconds) - finally: - writer.close() - await writer.wait_closed() + try: + return await asyncio.wait_for(start_session(), timeout_seconds) + finally: + writer.close() + await writer.wait_closed() + except: + logger.exception("unexpected exception") return session_cb