diff options
author | mkaay <mkaay@mkaay.de> | 2010-08-11 23:39:15 +0200 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2010-08-11 23:39:15 +0200 |
commit | 0313e405daf412898ef065f346e14539d3f36ef5 (patch) | |
tree | f4cd67444f2005491e932ea3d882747e5026f6df /module/HookManager.py | |
parent | removed print (diff) | |
parent | irc client fixes (diff) | |
download | pyload-0313e405daf412898ef065f346e14539d3f36ef5.tar.xz |
merge
Diffstat (limited to 'module/HookManager.py')
-rw-r--r-- | module/HookManager.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/module/HookManager.py b/module/HookManager.py index 7cd903403..41e4c5ef0 100644 --- a/module/HookManager.py +++ b/module/HookManager.py @@ -41,6 +41,14 @@ class HookManager(): args[0].lock.release() return res return new + + def try_catch(func): + def new(*args): + try: + return func(*args) + except Exception, e: + args[0].log.error(_("Error executing hooks: %s") % str(e)) + return new def createIndex(self): @@ -50,6 +58,7 @@ class HookManager(): #hookClass = getattr(plugin, plugin.__name__) if self.core.config.getPlugin(pluginClass.__name__, "load"): + #@TODO handle in pluginmanager plugin = pluginClass(self.core) plugins.append(plugin) self.log.info(_("%s loaded, activated %s") % (pluginClass.__name__, plugin.isActivated() )) @@ -67,6 +76,8 @@ class HookManager(): plugin.periodical() plugin.lastCall = time() + + @try_catch def coreReady(self): for plugin in self.plugins: if plugin.isActivated(): |