Commit 906612a0 authored by Daniel Silverstone's avatar Daniel Silverstone

_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's avatarDaniel Silverstone <daniel.silverstone@codethink.co.uk>
parent 6a965cd0
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment