new_event doesn't exist when check_success is false

This commit is contained in:
jesopo 2019-11-25 10:43:30 +00:00
parent 7f7a31720c
commit 73232b40e1

View file

@ -187,6 +187,8 @@ class Module(ModuleManager.BaseModule):
check) check)
event_kwargs["check_assert"] = check_assert event_kwargs["check_assert"] = check_assert
eaten = False
check_success, check_message = self._check("preprocess", event_kwargs) check_success, check_message = self._check("preprocess", event_kwargs)
if check_success: if check_success:
new_event = self.events.on(hook.event_name).make_event(**event_kwargs) new_event = self.events.on(hook.event_name).make_event(**event_kwargs)
@ -196,6 +198,7 @@ class Module(ModuleManager.BaseModule):
hook.call(new_event) hook.call(new_event)
except utils.EventError as e: except utils.EventError as e:
stderr.write(str(e)) stderr.write(str(e))
eaten = new_event.eaten
else: else:
if check_message: if check_message:
stderr.write("%s: %s" % (user.nickname, check_message)) stderr.write("%s: %s" % (user.nickname, check_message))
@ -203,7 +206,7 @@ class Module(ModuleManager.BaseModule):
self._check("postprocess", event_kwargs) self._check("postprocess", event_kwargs)
# postprocess - send stdout/stderr and typing tag # postprocess - send stdout/stderr and typing tag
return new_event.eaten return eaten
@utils.hook("postprocess.command") @utils.hook("postprocess.command")
@utils.kwarg("priority", EventManager.PRIORITY_LOW) @utils.kwarg("priority", EventManager.PRIORITY_LOW)