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
@ -158,7 +158,10 @@ class Module(object):
|
|||||||
elif strip_bot_name_from_input:
|
elif strip_bot_name_from_input:
|
||||||
what = addressed_re.sub('', what)
|
what = addressed_re.sub('', what)
|
||||||
|
|
||||||
|
try:
|
||||||
self.do(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
self.do(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
||||||
|
except Exception as e:
|
||||||
|
print('EXCEPTION: ' + str(e))
|
||||||
|
|
||||||
def on_privmsg(self, connection, event):
|
def on_privmsg(self, connection, event):
|
||||||
"""
|
"""
|
||||||
@ -190,7 +193,10 @@ class Module(object):
|
|||||||
if internal_only and replypath is not None:
|
if internal_only and replypath is not None:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
self.do(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
self.do(connection, event, nick, userhost, replypath, what, admin_unlocked)
|
||||||
|
except Exception as e:
|
||||||
|
print('EXCEPTION: ' + str(e))
|
||||||
|
|
||||||
def reload(self):
|
def reload(self):
|
||||||
"""Reload this module's code and then create a new object of it, removing the old."""
|
"""Reload this module's code and then create a new object of it, removing the old."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user