From 39c4ef17497c588671c75af3c2ad8e61c056dd72 Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 26 Sep 2018 11:19:48 +0100 Subject: [PATCH] Don't use assert, throw a better exception for module name collisions --- src/ModuleManager.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ModuleManager.py b/src/ModuleManager.py index 24b5fb8c..d0c72782 100644 --- a/src/ModuleManager.py +++ b/src/ModuleManager.py @@ -99,8 +99,9 @@ class ModuleManager(object): module_object._context = context module_object._import_name = name - assert not module_object._name in self.modules, ( - "module name '%s' attempted to be used twice.") + if name in self.modules: + raise ModuleNameCollisionException("Module name '%s' " + "attempted to be used twice") return module_object def load_module(self, name):