Commit 3993b037 authored by ZEN's avatar ZEN

callback param must be callable

parent 04fb2733
......@@ -315,6 +315,10 @@ class MocEventLoop(MocClient):
def register(self, event, callback):
if event not in self.ALLOWED_SIGNALS:
raise exceptions.MocError('Unsupported event type -> %s' % event)
if not hasattr(callback, '__call__'):
raise exceptions.MocError('`callback` param must be callable')
self._event_callbacks[event].append(callback)
def run(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment