Stop displaying the traceback when /xhtml fails.

Also make the except more restrictive.

Fixes #3514.
This commit is contained in:
Emmanuel Gil Peyrot 2020-12-26 23:46:20 +01:00 committed by Link Mauve
parent 1c5836a90f
commit 78b3933e4d

View file

@ -647,9 +647,9 @@ class ChatTab(Tab):
body = xhtml.clean_text(
xhtml.xhtml_to_poezio_colors(arg, force=True))
ET.fromstring(arg)
except:
except xml.sax._exceptions.SAXParseException:
self.core.information('Could not send custom xhtml', 'Error')
log.error('/xhtml: Unable to send custom xhtml', exc_info=True)
log.error('/xhtml: Unable to send custom xhtml')
return
msg = self.core.xmpp.make_message(self.get_dest_jid())