From 7d4c6b69412ff1ce25c6e73a77d00d736845c38d Mon Sep 17 00:00:00 2001 From: jesopo Date: Fri, 25 Oct 2019 14:14:30 +0100 Subject: [PATCH] bot.panic() should just call sys.exit() --- src/IRCBot.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/IRCBot.py b/src/IRCBot.py index e2868744..762676bb 100644 --- a/src/IRCBot.py +++ b/src/IRCBot.py @@ -21,9 +21,6 @@ class TriggerEvent(object): self.type = type self.callback = callback -class BitBotPanic(Exception): - pass - class ListLambdaPollHook(PollHook.PollHook): def __init__(self, collection: typing.Callable[[], typing.Iterable[typing.Any]], @@ -146,9 +143,7 @@ class Bot(object): if not reason == None: self.log.critical("panic() called: %s", [reason], exc_info=True) - self._event_queue.put(TriggerEvent(TriggerEventType.Kill)) - if throw: - raise BitBotPanic() + sys.exit(20) def _module_lists(self): db_whitelist = set(self.get_setting("module-whitelist", [])) @@ -269,11 +264,6 @@ class Bot(object): return thread def run(self): - try: - self._run() - except BitBotPanic: - return - def _run(self): self._writing = True self._reading = True @@ -334,8 +324,6 @@ class Bot(object): def _loop_catch(self, name: str, loop: typing.Callable[[], None]): try: loop() - except BitBotPanic: - return except Exception as e: self.panic("Exception on '%s' thread" % name, throw=False)