Permalink
Browse files

If a plugin throws an error, print a stack trace, and keep going.

  • Loading branch information...
1 parent a045c2c commit 65439e3e7cece9f6da8cc4a6acd3455f9c6d89e1 @mythmon mythmon committed Jul 27, 2011
Showing with 11 additions and 5 deletions.
  1. +11 −4 hamper/commander.py
  2. +0 −1 hamper/plugins/plugin_utils.py
View
@@ -1,8 +1,9 @@
import sys
import re
from collections import deque
-import yaml
+import traceback
+import yaml
from twisted.words.protocols import irc
from twisted.internet import protocol, reactor
import sqlalchemy
@@ -75,10 +76,16 @@ def privmsg(self, user, channel, msg):
}
# Plugins are already sorted by priority
+ stop = False
for plugin in self.factory.plugins:
- stop = plugin.process(self, comm)
- if stop:
- break
+ try:
+ stop = plugin.process(self, comm)
+ if stop:
+ break
+ except:
+ exc_type, exc_value, exc_traceback = sys.exc_info()
+ traceback.print_tb(exc_traceback)
+
#matchedPlugins = []
#for cmd in self.factory.plugins:
@@ -60,7 +60,6 @@ def reloadPlugin(self, bot, comm, *args):
def loadPlugin(self, bot, comm, *args):
"""Load a named plugin."""
name = ' '.join(args[1:])
-t
ps = bot.factory.plugins
matched_plugins = [p for p in ps if p.name == name]
if len(matched_plugins) != 0:

0 comments on commit 65439e3

Please sign in to comment.