diff options
author | Francisco Redondo Marchena <francisco.marchena@codethink.co.uk> | 2018-06-28 11:35:57 +0100 |
---|---|---|
committer | Francisco Redondo Marchena <francisco.marchena@codethink.co.uk> | 2018-06-28 15:18:10 +0100 |
commit | 463698ec3203190aeac1f41ed3885f08e95bceae (patch) | |
tree | 1e7cf80f19e1c8b01017437e0c99487297ca8098 /buildstream | |
parent | 91d87e3c901dd9ac2cd3e7d148e5313cc5b915b0 (diff) | |
download | buildstream-463698ec3203190aeac1f41ed3885f08e95bceae.tar.gz |
Add error message when running commands on directories
Issue #446
Diffstat (limited to 'buildstream')
-rw-r--r-- | buildstream/_exceptions.py | 3 | ||||
-rw-r--r-- | buildstream/_yaml.py | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/buildstream/_exceptions.py b/buildstream/_exceptions.py index 3aadd526d..377963244 100644 --- a/buildstream/_exceptions.py +++ b/buildstream/_exceptions.py @@ -197,6 +197,9 @@ class LoadErrorReason(Enum): # A project.conf file was missing MISSING_PROJECT_CONF = 17 + # Try to load a directory not a yaml file + LOADING_DIRECTORY = 18 + # LoadError # diff --git a/buildstream/_yaml.py b/buildstream/_yaml.py index bfd65865c..00336281c 100644 --- a/buildstream/_yaml.py +++ b/buildstream/_yaml.py @@ -184,6 +184,10 @@ def load(filename, shortname=None, copy_tree=False): except FileNotFoundError as e: raise LoadError(LoadErrorReason.MISSING_FILE, "Could not find file at {}".format(filename)) from e + except IsADirectoryError as e: + raise LoadError(LoadErrorReason.LOADING_DIRECTORY, + "{} is a directory. bst command is expecting a .bst file" + .format(filename)) from e # Like load(), but doesnt require the data to be in a file |