diff options
author | Wojtek Kosior <koszko@koszko.org> | 2022-05-11 10:35:51 +0200 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2022-05-11 11:12:24 +0200 |
commit | 98687e9148bac0a18bf6a62e672275af9a920d9c (patch) | |
tree | e9aea2c106f2b64bd09030322ec7214a813bb876 /src/hydrilla/builder/build.py | |
parent | 866922f80326671815c9187eed0ba6c4127b8721 (diff) | |
download | hydrilla-builder-98687e9148bac0a18bf6a62e672275af9a920d9c.tar.gz hydrilla-builder-98687e9148bac0a18bf6a62e672275af9a920d9c.zip |
raise a more informative error when a file referenced from index.json is missing
Diffstat (limited to 'src/hydrilla/builder/build.py')
-rw-r--r-- | src/hydrilla/builder/build.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/hydrilla/builder/build.py b/src/hydrilla/builder/build.py index feecdfe..8354331 100644 --- a/src/hydrilla/builder/build.py +++ b/src/hydrilla/builder/build.py @@ -212,10 +212,11 @@ class Build: file_ref = self.files_by_path.get(desired_path) if file_ref is None: - with open(path, 'rb') as file_handle: - contents = file_handle.read() + if not path.is_file(): + msg = _('referenced_file_{}_missing').format(desired_path) + raise FileReferenceError(msg) - file_ref = FileRef(desired_path, contents) + file_ref = FileRef(desired_path, path.read_bytes()) self.files_by_path[desired_path] = file_ref if include_in_distribution: |