From ecadad99f03e33d4672e9ac2d5d1dca0d541b983 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Wed, 11 Aug 2010 21:04:48 +0200 Subject: jeixs irc interface, cleaned some code --- module/HookManager.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'module/HookManager.py') 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(): -- cgit v1.2.3