mirror of
https://github.com/YunoHost/check-http.git
synced 2024-09-03 19:56:42 +02:00
[fix] never do catch all exceptions
This commit is contained in:
parent
f5e9385955
commit
69d6d54911
1 changed files with 5 additions and 1 deletions
|
@ -24,6 +24,7 @@ RATE_LIMIT_DB = {}
|
||||||
RATE_LIMIT_SECONDS = 300
|
RATE_LIMIT_SECONDS = 300
|
||||||
RATE_LIMIT_NB_REQUESTS = 10
|
RATE_LIMIT_NB_REQUESTS = 10
|
||||||
|
|
||||||
|
|
||||||
def clear_rate_limit_db(now):
|
def clear_rate_limit_db(now):
|
||||||
to_delete = []
|
to_delete = []
|
||||||
|
|
||||||
|
@ -349,7 +350,10 @@ async def check_smtp(request):
|
||||||
recv = sock.recv(1024).decode('utf-8')
|
recv = sock.recv(1024).decode('utf-8')
|
||||||
assert recv[:3] == "220"
|
assert recv[:3] == "220"
|
||||||
helo_domain = recv.split()[1].strip()
|
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({
|
return json_response({
|
||||||
'status': "error_smtp_bad_answer",
|
'status': "error_smtp_bad_answer",
|
||||||
'content': "SMTP server did not reply with '220 domain.tld' after opening socket ... Maybe another machine answered."
|
'content': "SMTP server did not reply with '220 domain.tld' after opening socket ... Maybe another machine answered."
|
||||||
|
|
Loading…
Reference in a new issue