bot: capture exceptions, try to report on them
it beats crashing, probably
This commit is contained in:
parent
9c4e0fe782
commit
1bbb64618d
|
@ -144,6 +144,7 @@ class DrReactor(irc.client.Reactor):
|
||||||
Also supports regex handlers.
|
Also supports regex handlers.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
try:
|
||||||
log.debug("EVENT: e[%s] s[%s] t[%s] a[%s]", event.type, event.source,
|
log.debug("EVENT: e[%s] s[%s] t[%s] a[%s]", event.type, event.source,
|
||||||
event.target, event.arguments)
|
event.target, event.arguments)
|
||||||
|
|
||||||
|
@ -189,6 +190,10 @@ class DrReactor(irc.client.Reactor):
|
||||||
result = handler.callback(connection, event)
|
result = handler.callback(connection, event)
|
||||||
if result == "NO MORE":
|
if result == "NO MORE":
|
||||||
return
|
return
|
||||||
|
except Exception as ex:
|
||||||
|
log.error("caught exception!")
|
||||||
|
log.exception(ex)
|
||||||
|
connection.privmsg(event.target, str(ex))
|
||||||
|
|
||||||
def try_recursion(self, connection, event):
|
def try_recursion(self, connection, event):
|
||||||
"""Scan message for subcommands to execute and use as part of this command.
|
"""Scan message for subcommands to execute and use as part of this command.
|
||||||
|
|
Loading…
Reference in New Issue