diff options
author | Richard Darst <rkd@zgib.net> | 2009-08-07 20:38:12 (GMT) |
---|---|---|
committer | Richard Darst <rkd@zgib.net> | 2009-08-07 20:38:12 (GMT) |
commit | 0a910ddb599d134251fe19767b486053319741bc (patch) | |
tree | 7396eff0457d7374b01c2fce1e39a899a5fb6c44 | |
parent | 4fde73ef8cc2d20e18f56f1324693c853f3fc024 (diff) |
Catch exceptions in outFilter and ignore them
- This prevents bugs in the MeetBot supybot plugin from preventing ALL
supybot output from getting to the user.
- This change catches any exceptions, prints them out, but then
continues execution without stopping.
darcs-hash:20090807203812-82ea9-0236a25670c0800a43166577e137baf4e8d37d38.gz
-rw-r--r-- | plugin.py | 25 |
1 files changed, 15 insertions, 10 deletions
@@ -123,16 +123,21 @@ class MeetBot(callbacks.Plugin): """ # Gotta catch my own messages *somehow* :) # Let's try this little trick... - if msg.command in ('PRIVMSG'): - # Note that we have to get our nick and network parameters - # in a slightly different way here, compared to doPrivmsg. - nick = irc.nick - channel = msg.args[0] - payload = msg.args[1] - Mkey = (channel,irc.network) - M = meeting_cache.get(Mkey, None) - if M is not None: - M.addrawline(nick, payload) + try: + if msg.command in ('PRIVMSG'): + # Note that we have to get our nick and network parameters + # in a slightly different way here, compared to doPrivmsg. + nick = irc.nick + channel = msg.args[0] + payload = msg.args[1] + Mkey = (channel,irc.network) + M = meeting_cache.get(Mkey, None) + if M is not None: + M.addrawline(nick, payload) + except: + import traceback + print traceback.print_exc() + print "(above exception in outFilter, ignoring)" return msg # These are admin commands, for use by the bot owner when there |