catch all exceptions around self.do, and log to console
as much as i find this uncouth, it is handy, and also it seems that the megahal brain gets corrupted/unusable when an exception isn't caught and the bot dies. this should cover most of the cases
This commit is contained in:
parent
f590daf5cd
commit
377d2145fa
10
Module.py
10
Module.py
@ -158,7 +158,10 @@ class Module(object):
|
||||
elif strip_bot_name_from_input:
|
||||
what = addressed_re.sub('', what)
|
||||
|
||||
self.do(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
||||
try:
|
||||
self.do(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
||||
except Exception as e:
|
||||
print('EXCEPTION: ' + str(e))
|
||||
|
||||
def on_privmsg(self, connection, event):
|
||||
"""
|
||||
@ -190,7 +193,10 @@ class Module(object):
|
||||
if internal_only and replypath is not None:
|
||||
return
|
||||
|
||||
self.do(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
||||
try:
|
||||
self.do(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
||||
except Exception as e:
|
||||
print('EXCEPTION: ' + str(e))
|
||||
|
||||
def reload(self):
|
||||
"""Reload this module's code and then create a new object of it, removing the old."""
|
||||
|
Loading…
Reference in New Issue
Block a user