diff options
author | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2019-04-01 11:36:34 +0100 |
---|---|---|
committer | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2019-04-01 15:30:18 +0100 |
commit | 906612a0e340329f3317b0f152735c8dc8910efe (patch) | |
tree | 396ca3afb54a1b7095e0963efb0c6f9dd9b9e803 | |
parent | 6a965cd00b90a485ce88312ed7ac2d90286d7c26 (diff) | |
download | buildstream-906612a0e340329f3317b0f152735c8dc8910efe.tar.gz |
_yaml.py::load(): Re-raise LoadError with displayname
In the case that `load_data()` raises a `LoadError` we want to catch
and re-raise it, augmenting the message with where the load came from
which is best done with the `displayname` to include junction name if
available.
Signed-off-by: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
-rw-r--r-- | buildstream/_yaml.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/buildstream/_yaml.py b/buildstream/_yaml.py index 1512a3cb8..519d91b34 100644 --- a/buildstream/_yaml.py +++ b/buildstream/_yaml.py @@ -334,6 +334,8 @@ def load(filename, shortname=None, copy_tree=False, *, project=None): raise LoadError(LoadErrorReason.LOADING_DIRECTORY, "{} is a directory. bst command expects a .bst file." .format(filename)) from e + except LoadError as e: + raise LoadError(e.reason, "{}: {}".format(displayname, e)) from e # Like load(), but doesnt require the data to be in a file |