From f275756451e2fd8bbad683c7dc4654a0cfce36af Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Sun, 31 Jan 2021 21:33:54 +0100 Subject: [PATCH] Show tracebacks for bot exceptions --- xbotlib.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xbotlib.py b/xbotlib.py index 238c964..e39fee2 100644 --- a/xbotlib.py +++ b/xbotlib.py @@ -13,6 +13,7 @@ from os import environ from os.path import exists from pathlib import Path from sys import exit, stdout +from traceback import print_exc from humanize import naturaldelta from slixmpp import ClientXMPP @@ -545,7 +546,8 @@ class Bot(ClientXMPP): try: self.direct(message) except Exception as exception: - self.log.error(f"Bot.direct threw exception {exception}") + self.log.error(f"Bot.direct threw exception: {exception}") + print_exc(file=stdout) if self.storage == "file": self.db._dumps() @@ -628,6 +630,7 @@ class Bot(ClientXMPP): self.group(message) except Exception as exception: self.log.error(f"Bot.group threw exception: {exception}") + print_exc(file=stdout) if self.storage == "file": self.db._dumps()