aboutsummaryrefslogtreecommitdiff
path: root/interpreter.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2013-05-26 22:32:54 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2013-05-26 22:32:54 +0300
commit5ad891632382b2ba2b9932f7d0e53ba23dc8b6a9 (patch)
treefa020a5265106d1c0b0a8f9e8fbbcea66e212663 /interpreter.py
parent6ff098bea6c2722b659d8f8b03604fc365950045 (diff)
downloadmeson-5ad891632382b2ba2b9932f7d0e53ba23dc8b6a9.zip
meson-5ad891632382b2ba2b9932f7d0e53ba23dc8b6a9.tar.gz
meson-5ad891632382b2ba2b9932f7d0e53ba23dc8b6a9.tar.bz2
Add line number and file information to exception objects at one location.
Diffstat (limited to 'interpreter.py')
-rwxr-xr-xinterpreter.py11
1 files changed, 9 insertions, 2 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):