fetchmail: print unhandled exceptions, but don't crash

refs #1295
master
Alexander A. Klimov 5 years ago
parent b8b1699f9e
commit 313e98c1a2

@ -8,6 +8,7 @@ import subprocess
import re import re
import requests import requests
import sys import sys
import traceback
FETCHMAIL = """ FETCHMAIL = """
@ -45,6 +46,7 @@ def fetchmail(fetchmailrc):
def run(debug): def run(debug):
try:
fetches = requests.get("http://admin/internal/fetch").json() fetches = requests.get("http://admin/internal/fetch").json()
smtphost, smtpport = extract_host_port(os.environ.get("HOST_SMTP", "smtp"), None) smtphost, smtpport = extract_host_port(os.environ.get("HOST_SMTP", "smtp"), None)
if smtpport is None: if smtpport is None:
@ -86,6 +88,8 @@ def run(debug):
requests.post("http://admin/internal/fetch/{}".format(fetch["id"]), requests.post("http://admin/internal/fetch/{}".format(fetch["id"]),
json=error_message.split("\n")[0] json=error_message.split("\n")[0]
) )
except Exception:
traceback.print_exc()
if __name__ == "__main__": if __name__ == "__main__":

Loading…
Cancel
Save