Errors lack context when files are not found
Summary
When specifying a dependency that does not exist, the resulting error lacks the required provenance at the beginning, so the user is left to painfully grep through the project to find where the reference to the non-existent element is.
Further, when specifying a sub-project (cross junction) element as a dependency, the error message is even more confusing, as it refers to the temporary cache directory where the junction project is staged instead of referring to the project by it's junction name, e.g, today I got this message:
Could not find element 'vm/linux-vm-boot/systemd.bst' in elements directory '/home/tristan/.cache/buildstream/build/freedesktop-sdk-oew_pua6/elements'
The above error should look more like:
[vm/desktop-vm.bst line: 19 column 12]: Could not find element 'vm/linux-vm-boot/systemd.bst' in subproject 'freedesktop-sdk.bst'
Steps to reproduce
Create a project with a dependency to a non-existing element
What is the current bug behavior?
Error message lacks provenance and refers to a staged element directory instead of the junction name in the case of a cross-junction element.
What is the expected correct behavior?
A fully qualified error targeted at making the users life easier.
Relevant logs and/or screenshots
Possible fixes
Looking at the loader code, it looks like the _load_file()
method and perhaps also the _get_loader()
method should both take a provenance argument.
The provenance argument would be expected to be None
in the case of toplevel target elements, in which case the provenance can be safely omitted from the error message (as it was directly specified by the user on the command line).