From 877287291ae395cfe0c61994a9c44d38adfe211f Mon Sep 17 00:00:00 2001 From: jesopo Date: Fri, 25 Oct 2019 14:31:09 +0100 Subject: [PATCH] `reason` arg of `panic()` shouldn't be optional, detect current exception --- modules/ircv3_sasl/__init__.py | 2 +- src/IRCBot.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/ircv3_sasl/__init__.py b/modules/ircv3_sasl/__init__.py index 83be2d7c..061414ad 100644 --- a/modules/ircv3_sasl/__init__.py +++ b/modules/ircv3_sasl/__init__.py @@ -164,7 +164,7 @@ class Module(ModuleManager.BaseModule): self.log.error(message) self.bot.disconnect(server) else: - self.bot.panic(reason=message) + self.bot.panic(message) else: self.log.warn("SASL failure for %s: %s" % (str(server), message)) self._end_sasl(server) diff --git a/src/IRCBot.py b/src/IRCBot.py index 1103dd9c..bd00b0d6 100644 --- a/src/IRCBot.py +++ b/src/IRCBot.py @@ -137,12 +137,12 @@ class Bot(object): elif type == TriggerResult.Return: return returned - def panic(self, reason=None): - callback = None - - if not reason == None: - self.log.critical("panic() called: %s", [reason], exc_info=True) + def panic(self, reason): + exc_info = False + if any(sys.exc_info()): + exc_info = True + self.log.critical("panic() called: %s", [reason], exc_info=exc_info) sys.exit(20) def _module_lists(self):