summaryrefslogtreecommitdiff
path: root/src/hydrilla/builder/build.py
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-05-11 10:35:51 +0200
committerWojtek Kosior <koszko@koszko.org>2022-05-11 11:12:24 +0200
commit98687e9148bac0a18bf6a62e672275af9a920d9c (patch)
treee9aea2c106f2b64bd09030322ec7214a813bb876 /src/hydrilla/builder/build.py
parent866922f80326671815c9187eed0ba6c4127b8721 (diff)
downloadhydrilla-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.py7
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: