Skip to content

check-invariant: Print the current package name on errors

Emanuele Aina requested to merge wip/em/per-package-error-reporting into master

When getting an exception, ensure the current package name is printed to debug which one has faulty data.

For instance this is now the output, previously only the first exception was printed:

Traceback (most recent call last):
  File "./bin/packaging-check-invariants", line 586, in <module>
    checker.check_missing_license_report(package)
  File "./bin/packaging-check-invariants", line 533, in check_missing_license_report
    if branch.component == "target" and not branch.license_report:
  File "./bin/packaging-check-invariants", line 90, in __getattr__
    item = super(DictWrapper, self).__getitem__(attr)
KeyError: 'component'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "./bin/packaging-check-invariants", line 588, in <module>
    raise Error(package.name) from e
__main__.Error: aalib

For instance: https://gitlab.apertis.org/infrastructure/dashboard/-/jobs/1407040

Task: https://phabricator.apertis.org/T8402

Merge request reports