Merge "Add new dsl exception for better error reporting"
This commit is contained in:
commit
7e07bafb7f
@ -44,8 +44,11 @@ class NoMethodFound(Exception):
|
||||
|
||||
|
||||
class NoClassFound(Exception):
|
||||
def __init__(self, name):
|
||||
super(NoClassFound, self).__init__('Class "%s" is not found' % name)
|
||||
def __init__(self, name, packages=[]):
|
||||
packages = ', '.join("{0}/{1}".format(p.name, p.version)
|
||||
for p in packages)
|
||||
super(NoClassFound, self).__init__(
|
||||
'Class "{0}" is not found in {1}'.format(name, packages))
|
||||
|
||||
|
||||
class NoPackageFound(Exception):
|
||||
|
@ -143,8 +143,8 @@ class MuranoPackage(dsl_types.MuranoPackage):
|
||||
result = self._classes.get(name)
|
||||
if result:
|
||||
return result
|
||||
|
||||
if search_requirements:
|
||||
pkgs_for_search = []
|
||||
for package_name, version_spec in self._requirements.iteritems():
|
||||
if package_name == self.name:
|
||||
continue
|
||||
@ -153,8 +153,11 @@ class MuranoPackage(dsl_types.MuranoPackage):
|
||||
try:
|
||||
return referenced_package.find_class(name, False)
|
||||
except exceptions.NoClassFound:
|
||||
pkgs_for_search.append(referenced_package)
|
||||
continue
|
||||
raise exceptions.NoClassFound(name)
|
||||
raise exceptions.NoClassFound(name, packages=pkgs_for_search)
|
||||
|
||||
raise exceptions.NoClassFound(name, packages=[self])
|
||||
|
||||
@property
|
||||
def context(self):
|
||||
|
Loading…
Reference in New Issue
Block a user