bot.panic() should just call sys.exit()
This commit is contained in:
parent
0f0924281c
commit
7d4c6b6941
1 changed files with 1 additions and 13 deletions
|
@ -21,9 +21,6 @@ class TriggerEvent(object):
|
||||||
self.type = type
|
self.type = type
|
||||||
self.callback = callback
|
self.callback = callback
|
||||||
|
|
||||||
class BitBotPanic(Exception):
|
|
||||||
pass
|
|
||||||
|
|
||||||
class ListLambdaPollHook(PollHook.PollHook):
|
class ListLambdaPollHook(PollHook.PollHook):
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
collection: typing.Callable[[], typing.Iterable[typing.Any]],
|
collection: typing.Callable[[], typing.Iterable[typing.Any]],
|
||||||
|
@ -146,9 +143,7 @@ class Bot(object):
|
||||||
if not reason == None:
|
if not reason == None:
|
||||||
self.log.critical("panic() called: %s", [reason], exc_info=True)
|
self.log.critical("panic() called: %s", [reason], exc_info=True)
|
||||||
|
|
||||||
self._event_queue.put(TriggerEvent(TriggerEventType.Kill))
|
sys.exit(20)
|
||||||
if throw:
|
|
||||||
raise BitBotPanic()
|
|
||||||
|
|
||||||
def _module_lists(self):
|
def _module_lists(self):
|
||||||
db_whitelist = set(self.get_setting("module-whitelist", []))
|
db_whitelist = set(self.get_setting("module-whitelist", []))
|
||||||
|
@ -269,11 +264,6 @@ class Bot(object):
|
||||||
return thread
|
return thread
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
try:
|
|
||||||
self._run()
|
|
||||||
except BitBotPanic:
|
|
||||||
return
|
|
||||||
def _run(self):
|
|
||||||
self._writing = True
|
self._writing = True
|
||||||
self._reading = True
|
self._reading = True
|
||||||
|
|
||||||
|
@ -334,8 +324,6 @@ class Bot(object):
|
||||||
def _loop_catch(self, name: str, loop: typing.Callable[[], None]):
|
def _loop_catch(self, name: str, loop: typing.Callable[[], None]):
|
||||||
try:
|
try:
|
||||||
loop()
|
loop()
|
||||||
except BitBotPanic:
|
|
||||||
return
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.panic("Exception on '%s' thread" % name, throw=False)
|
self.panic("Exception on '%s' thread" % name, throw=False)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue