Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output component level error information #428

Open
elikoga opened this issue Dec 20, 2023 · 0 comments
Open

Output component level error information #428

elikoga opened this issue Dec 20, 2023 · 0 comments

Comments

@elikoga
Copy link
Contributor

elikoga commented Dec 20, 2023

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant