Add in more error checking on the automagic routine.

This commit is contained in:
Mike Auty
2016-08-14 00:28:20 +01:00
parent c160698465
commit c6b60a0035
@@ -18,6 +18,10 @@ def run(automagics, context, configurable, config_path = ""):
This is where any automagic is allowed to run, and alter the context in order to satisfy/improve all requirements
"""
for automagic in automagics:
if not isinstance(automagic, automagic_interface.AutomagicInterface):
raise TypeError("Automagics must only contain AutomagicInterface subclasses")
if not isinstance(configurable, ConfigurableInterface) and not issubclass(configurable, ConfigurableInterface):
raise TypeError("Automagic operates on configurables only")