Don't use assert, throw a better exception for module name collisions
This commit is contained in:
parent
c3e8e234eb
commit
39c4ef1749
1 changed files with 3 additions and 2 deletions
|
@ -99,8 +99,9 @@ class ModuleManager(object):
|
||||||
module_object._context = context
|
module_object._context = context
|
||||||
module_object._import_name = name
|
module_object._import_name = name
|
||||||
|
|
||||||
assert not module_object._name in self.modules, (
|
if name in self.modules:
|
||||||
"module name '%s' attempted to be used twice.")
|
raise ModuleNameCollisionException("Module name '%s' "
|
||||||
|
"attempted to be used twice")
|
||||||
return module_object
|
return module_object
|
||||||
|
|
||||||
def load_module(self, name):
|
def load_module(self, name):
|
||||||
|
|
Loading…
Reference in a new issue