record the type name, if there is no such type

Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
Nico Schottelius 2013-09-02 11:30:22 +02:00
parent 6cd419b334
commit 73338c330b
2 changed files with 5 additions and 4 deletions

View file

@ -25,7 +25,8 @@ import os
import cdist
class NoSuchTypeError(cdist.Error):
def __init__(self, type_path, type_absolute_path):
def __init__(self, name, type_path, type_absolute_path):
self.name = name
self.type_path = type_path
self.type_absolute_path = type_absolute_path
@ -48,7 +49,7 @@ class CdistType(object):
self.path = self.name
self.absolute_path = os.path.join(self.base_path, self.path)
if not os.path.isdir(self.absolute_path):
raise NoSuchTypeError(self.path, self.absolute_path)
raise NoSuchTypeError(self.name, self.path, self.absolute_path)
self.manifest_path = os.path.join(self.name, "manifest")
self.explorer_path = os.path.join(self.name, "explorer")
self.gencode_local_path = os.path.join(self.name, "gencode-local")

View file

@ -177,8 +177,8 @@ class Emulator(object):
# Raises an error, if object cannot be created
try:
cdist_object = self.cdist_object.object_from_name(requirement)
except core.cdist_type.NoSuchTypeError:
self.log.error("%s requires object %s with non-existing type at %s" % (self.cdist_object.name, requirement, self.object_source))
except core.cdist_type.NoSuchTypeError as e:
self.log.error("%s requires object %s, but type %s does not exist (definded at %s)" % (self.cdist_object.name, requirement, e.name, self.object_source))
raise