From 02779939f0882c0bd4f5f1e92a9a88b8a1d1af42 Mon Sep 17 00:00:00 2001 From: Ruud Date: Fri, 14 Jun 2013 17:46:19 +0200 Subject: [PATCH] Catch im_self error --- couchpotato/core/event.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/couchpotato/core/event.py b/couchpotato/core/event.py index f7590ece..237c4e0e 100644 --- a/couchpotato/core/event.py +++ b/couchpotato/core/event.py @@ -21,17 +21,20 @@ def addEvent(name, handler, priority = 100): def createHandle(*args, **kwargs): - # Open handler - parent = handler.im_self - bc = hasattr(parent, 'beforeCall') - if bc: parent.beforeCall(handler) + try: + # Open handler + parent = handler.im_self + bc = hasattr(parent, 'beforeCall') + if bc: parent.beforeCall(handler) - # Main event - h = runHandler(name, handler, *args, **kwargs) + # Main event + h = runHandler(name, handler, *args, **kwargs) - # Close handler - ac = hasattr(parent, 'afterCall') - if ac: parent.afterCall(handler) + # Close handler + ac = hasattr(parent, 'afterCall') + if ac: parent.afterCall(handler) + except: + log.error('Failed creating handler %s: %s', (name, traceback.format_exc())) return h