Raise a KeyError exception if trying to stop a component that hasn't
isn't registered
This commit is contained in:
parent
c8f2173a04
commit
78f9f22a40
|
@ -252,11 +252,20 @@ class ComponentRegistry(object):
|
|||
sucessfully stopped
|
||||
:rtype: twisted.internet.defer.Deferred
|
||||
|
||||
:raises KeyError: if a component name is not registered
|
||||
|
||||
"""
|
||||
if not names:
|
||||
names = self.components.keys()
|
||||
elif isinstance(names, str):
|
||||
if names in self.components:
|
||||
names = [names]
|
||||
else:
|
||||
raise KeyError("%s is not a registered component!" % names)
|
||||
|
||||
for name in names:
|
||||
if name is not in self.components:
|
||||
raise KeyError("%s is not a registered component!" % name)
|
||||
|
||||
deferreds = []
|
||||
|
||||
|
|
Loading…
Reference in New Issue