aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xinterpreter.py11
-rwxr-xr-xmeson.py2
2 files changed, 10 insertions, 3 deletions
diff --git a/interpreter.py b/interpreter.py
index a67286f..61ea28d 100755
--- a/interpreter.py
+++ b/interpreter.py
@@ -634,12 +634,19 @@ class Interpreter():
if node is None:
return
if not isinstance(node, nodes.CodeBlock):
- raise InvalidCode('Line %d: Tried to execute a non-codeblock. Possibly a bug in the parser.' % node.lineno())
+ e = InvalidCode('Tried to execute a non-codeblock. Possibly a bug in the parser.')
+ e.lineno = node.lineno()
+ raise e
statements = node.get_statements()
i = 0
while i < len(statements):
cur = statements[i]
- self.evaluate_statement(cur)
+ try:
+ self.evaluate_statement(cur)
+ except Exception as e:
+ e.lineno = cur.lineno()
+ e.file = os.path.join(self.subdir, 'meson.build')
+ raise e
i += 1 # In THE FUTURE jump over blocks and stuff.
def get_variable(self, varname):
diff --git a/meson.py b/meson.py
index a1b7858..62aa606 100755
--- a/meson.py
+++ b/meson.py
@@ -129,7 +129,7 @@ if __name__ == '__main__':
app.generate()
except Exception as e:
if isinstance(e, MesonException):
- print('\nMeson encountered an error:')
+ print('\nMeson encountered an error in %s:%d:' % (e.file, e.lineno))
print(e)
sys.exit(1)
else: