diff --git a/edbob/exceptions.py b/edbob/exceptions.py index a5a802e..58da82f 100644 --- a/edbob/exceptions.py +++ b/edbob/exceptions.py @@ -73,6 +73,12 @@ class LoadSpecError(Exception): return None +class InvalidSpec(LoadSpecError): + + def specifics(self): + return "invalid spec" + + class ModuleMissingAttribute(LoadSpecError): """ Raised during :func:`edbob.load_spec()` when the module imported okay but diff --git a/edbob/modules.py b/edbob/modules.py index e3d4287..2cdf59b 100644 --- a/edbob/modules.py +++ b/edbob/modules.py @@ -82,6 +82,9 @@ def load_spec(spec): necessary. """ + if spec.count(':') != 1: + raise exceptions.InvalidSpec(spec) + module_path, obj = spec.split(':') module = import_module_path(module_path) try: