diff options
author | Angelos Evripiotis <jevripiotis@bloomberg.net> | 2018-10-23 11:21:59 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2019-02-11 09:24:48 +0000 |
commit | 4336e3bfff34e3d1bd1cf5ee4816ba1aa14b9f01 (patch) | |
tree | 53f3fd3caa60676b6b016b7f49f76a65936c707b /buildstream | |
parent | 02e48209ec7af316afc8390dcb14d1135115878b (diff) | |
download | buildstream-4336e3bfff34e3d1bd1cf5ee4816ba1aa14b9f01.tar.gz |
_includes: better error on including directory
Previously, include a directory result in an error like this:
mydir is a directory. bst command expects a .bst file.
Note that the file containing the include was not mentioned.
Now we get an error like this instead:
element.bst [line 12 column 0]: Include block references a
directory instead of a file: 'mydir'.
Diffstat (limited to 'buildstream')
-rw-r--r-- | buildstream/_includes.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/buildstream/_includes.py b/buildstream/_includes.py index cb7faa4de..7548e155c 100644 --- a/buildstream/_includes.py +++ b/buildstream/_includes.py @@ -58,6 +58,10 @@ class Includes: message = "{}: Include block references a file that could not be found: '{}'.".format( include_provenance, include) raise LoadError(LoadErrorReason.MISSING_FILE, message) from e + elif e.reason == LoadErrorReason.LOADING_DIRECTORY: + message = "{}: Include block references a directory instead of a file: '{}'.".format( + include_provenance, include) + raise LoadError(LoadErrorReason.LOADING_DIRECTORY, message) from e else: raise |