catch StopIteration.value, pass back EventError that comes from a generator

This commit is contained in:
jesopo 2019-06-14 12:48:26 +01:00
parent 74a4d7077d
commit 3fad17d1b9

View file

@ -174,8 +174,8 @@ class Module(ModuleManager.BaseModule):
try: try:
next_success, next_return = self._hook_call_catch( next_success, next_return = self._hook_call_catch(
lambda: next(hook_return)) lambda: next(hook_return))
except StopIteration: except StopIteration as e:
break return True, e.value
if next_success: if next_success:
multi_check = None multi_check = None
@ -191,7 +191,7 @@ class Module(ModuleManager.BaseModule):
if not check_success: if not check_success:
return False, check_message return False, check_message
else: else:
break return False, next_return
return hook_success, hook_return return hook_success, hook_return
def command(self, server, target, target_str, is_channel, user, command, def command(self, server, target, target_str, is_channel, user, command,