diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2018-07-06 23:21:04 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2018-07-07 04:33:24 -0700 |
commit | 80392225a61a5baa28ef1f45bfc19b4623d2d188 (patch) | |
tree | 8a5f4754aea7d1fa07c9df76efd5bb658ff6c962 /mesonbuild/mesonlib.py | |
parent | 4fb00ee1d8c79184e3a77f9266e90d42ff595f41 (diff) | |
download | meson-80392225a61a5baa28ef1f45bfc19b4623d2d188.zip meson-80392225a61a5baa28ef1f45bfc19b4623d2d188.tar.gz meson-80392225a61a5baa28ef1f45bfc19b4623d2d188.tar.bz2 |
Raise a MesonException when substituting an invalid value
Avoids throwing a traceback. Also, warn when setting such a value.
Diffstat (limited to 'mesonbuild/mesonlib.py')
-rw-r--r-- | mesonbuild/mesonlib.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index 6b1fb76..f3682ce 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -603,7 +603,9 @@ def do_replacement(regex, line, format, confdata): elif isinstance(var, int): var = str(var) else: - raise RuntimeError('Tried to replace a variable with something other than a string or int.') + msg = 'Tried to replace variable {!r} value with ' \ + 'something other than a string or int: {!r}' + raise MesonException(msg.format(varname, var)) else: missing_variables.add(varname) var = '' |