mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-24 11:42:51 +01:00
classes: allow hook functions to block further execution by returning False
Closes #547.
This commit is contained in:
parent
4a01948647
commit
2e66b9bde6
@ -238,7 +238,13 @@ class PyLinkNetworkCore(structures.DeprecatedAttributesObject, structures.CamelC
|
|||||||
try:
|
try:
|
||||||
log.debug('(%s) Calling hook function %s from plugin "%s"', self.name,
|
log.debug('(%s) Calling hook function %s from plugin "%s"', self.name,
|
||||||
hook_func, hook_func.__module__)
|
hook_func, hook_func.__module__)
|
||||||
hook_func(self, numeric, command, parsed_args)
|
retcode = hook_func(self, numeric, command, parsed_args)
|
||||||
|
|
||||||
|
if retcode is False:
|
||||||
|
log.debug('(%s) Stopping hook loop for %r (command=%r)', self.name,
|
||||||
|
hook_func, command)
|
||||||
|
break
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
# We don't want plugins to crash our servers...
|
# We don't want plugins to crash our servers...
|
||||||
log.exception('(%s) Unhandled exception caught in hook %r from plugin "%s"',
|
log.exception('(%s) Unhandled exception caught in hook %r from plugin "%s"',
|
||||||
|
Loading…
Reference in New Issue
Block a user