WIP: Use context_for_bsterror to provide provenance on error
Description
Provide provenance information in the error if project.conf is missing from a junction, like so:
callHello.bst [line 8 column 4]: Could not find the project.conf file in the project referred to by junction element 'hello-junction.bst'. Was expecting it at path 'project' in the junction's source.
Changes proposed in this merge request:
- Add
BstError.add_context()that accepts stringifiable things to add to exception error messages. - Add a custom
BstError.__str__method, so context is prepended like so: 'context: original message'. - Introduce a new
context_for_bsterrorcontext manager, which does thetry,except, andadd_context()for you. - Fixup some instances of using
"{}".format(e)instead ofstr(e). - Add a usage of
context_for_bsterror. - ... TODO: more usages of
context_for_bsterror.
This merge request, when approved, will close:
Helps #960 (closed)
Edited by Angelos Evripiotis