Update catalogs and providers error messages

This commit is contained in:
Roman Mogilatov 2015-12-15 16:46:55 +02:00
parent 76e4837201
commit c6b79a8052
4 changed files with 5 additions and 7 deletions

View File

@ -336,8 +336,8 @@ class DynamicCatalog(object):
if (self.__class__.provider_type and
not isinstance(provider, self.__class__.provider_type)):
raise Error('{0} can contaon only {1} instances'.format(
self.name, self.__class__.provider_type))
raise Error('{0} can contain only {1} instances'.format(
self, self.__class__.provider_type))
if name in self.providers:
raise Error('Catalog {0} already has provider with '

View File

@ -407,9 +407,7 @@ class Factory(Callable):
if (self.__class__.provided_type and
not issubclass(provides, self.__class__.provided_type)):
raise Error('{0} can provide only {1} instances'.format(
'.'.join((self.__class__.__module__,
self.__class__.__name__)),
self.__class__.provided_type))
self.__class__, self.__class__.provided_type))
self.attributes = tuple(injection
for injection in args

View File

@ -31,5 +31,5 @@ try:
some_service_provider = ServiceProvider(object)
except errors.Error as exception:
print exception
# __main__.ServiceProvider can provide only
# <class '__main__.ServiceProvider'> can provide only
# <class '__main__.BaseService'> instances

View File

@ -31,5 +31,5 @@ try:
some_service_provider = ServiceProvider(object)
except errors.Error as exception:
print exception
# __main__.ServiceProvider can provide only
# <class '__main__.ServiceProvider'> can provide only
# <class '__main__.BaseService'> instances