aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2023-08-16 10:18:25 -0400
committerJussi Pakkanen <jpakkane@gmail.com>2023-08-16 14:48:09 -0700
commitf88a9cd6b374676e8f47da7137c8cd77c5bc2ccf (patch)
tree949a4d66e173e2e8d1251a62a833141b8711e3d9 /mesonbuild
parent8a7fdd91599823e2d7e693ce8525ed833c6a8126 (diff)
downloadmeson-f88a9cd6b374676e8f47da7137c8cd77c5bc2ccf.zip
meson-f88a9cd6b374676e8f47da7137c8cd77c5bc2ccf.tar.gz
meson-f88a9cd6b374676e8f47da7137c8cd77c5bc2ccf.tar.bz2
fs.read(): Catch FileNotFoundError
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/modules/fs.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/mesonbuild/modules/fs.py b/mesonbuild/modules/fs.py
index 7d96995..53174d2 100644
--- a/mesonbuild/modules/fs.py
+++ b/mesonbuild/modules/fs.py
@@ -261,8 +261,10 @@ class FSModule(ExtensionModule):
try:
with open(path, encoding=encoding) as f:
data = f.read()
+ except FileNotFoundError:
+ raise MesonException(f'File {args[0]} does not exist.')
except UnicodeDecodeError:
- raise MesonException(f'decoding failed for {path}')
+ raise MesonException(f'decoding failed for {args[0]}')
# Reconfigure when this file changes as it can contain data used by any
# part of the build configuration (e.g. `project(..., version:
# fs.read_file('VERSION')` or `configure_file(...)`