From 69d6d54911e748d3620009b4a0b3500684b779e4 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Fri, 8 Jan 2021 02:33:56 +0100 Subject: [PATCH] [fix] never do catch all exceptions --- yunodiagnoser.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/yunodiagnoser.py b/yunodiagnoser.py index d50d1eb..23106e9 100644 --- a/yunodiagnoser.py +++ b/yunodiagnoser.py @@ -24,6 +24,7 @@ RATE_LIMIT_DB = {} RATE_LIMIT_SECONDS = 300 RATE_LIMIT_NB_REQUESTS = 10 + def clear_rate_limit_db(now): to_delete = [] @@ -349,7 +350,10 @@ async def check_smtp(request): recv = sock.recv(1024).decode('utf-8') assert recv[:3] == "220" helo_domain = recv.split()[1].strip() - except: + except Exception as e: + import traceback + traceback.print_exc() + print(f"Error when trying to get smtp answer: {e}") return json_response({ 'status': "error_smtp_bad_answer", 'content': "SMTP server did not reply with '220 domain.tld' after opening socket ... Maybe another machine answered."