Skip to content

Output component level error information #428

@elikoga

Description

@elikoga

self.parent = parent
self.workdir = parent.workdir
self.sub_components = []
if self.parent is self.root:
self._overrides(self.root.overrides)
# Fix up attributes that have been set through the constructor.
for k, v in list(self.__dict__.items()):
attribute = getattr(self.__class__, k, None)
if not isinstance(attribute, Attribute):
continue
# Setting it using the mutator causes conversions and our
# special attribute handling to catch up.
setattr(self, k, v)
with self.chdir(self.defdir):
self.configure()
self += self._get_platform()
self._platform_component = self._
self.__setup_event_handlers__()
self._prepared = True

If we try catch and rethrow errors in this function, we can enrich them with their tracebacks more meaningfully than having to throw a UnknownComponentConfigurationError as here

except Exception as e:
# An unknown exception which we have to work harder
# to report gracefully.
ex_type, ex, tb = sys.exc_info()
exceptions.append(
UnknownComponentConfigurationError.from_context(
root, e, tb
)
)

Which says that this may indicate a bug in batou. But we don't want to have the message in a few cases (for example, user errors when using the templating mechanism (see #417)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions