Improve output on send exception

- Fix the stray "f" inside the string breaking the color
- Don't hide the traceback from the user, as it's impossibe to track down issues
  without it ("exception: None"?!)
- HTML escape the exception message - while somewhat unlikely, it could contain
  HTML characters.
This commit is contained in:
Florian Bruhin 2024-09-12 10:26:58 +02:00
parent 503763c4d7
commit cfcfe7ca29

View File

@ -31,6 +31,7 @@ import email.policy
import email.message
import mimetypes
import subprocess
import traceback
from subprocess import PIPE, Popen, TimeoutExpired
import tempfile
import typing
@ -460,4 +461,6 @@ class SendmailThread(QThread):
except TimeoutExpired:
self.panel.status = f'<i style="color:{settings.theme["fg_bad"]}">timed out</i>'
except Exception as e:
self.panel.status = f'<i style=f"color:{settings.theme["fg_bad"]}">exception {e}</i>'
msg = util.simple_escape(str(e))
self.panel.status = f'<i style="color:{settings.theme["fg_bad"]}">exception {msg} (traceback on stderr)</i>'
traceback.print_exc()