From 85f2b3c3ee74009495988512517166128fe91ccd Mon Sep 17 00:00:00 2001 From: Salvo 'LtWorf' Tomaselli Date: Thu, 31 Mar 2016 21:37:43 +0200 Subject: [PATCH] Error message when compilation fails Within selection, the compilation of the string into python bytecode can fail. This shows an appropriate message. --- relational/relation.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/relational/relation.py b/relational/relation.py index 1d3ffd2..c7d34f0 100644 --- a/relational/relation.py +++ b/relational/relation.py @@ -130,7 +130,10 @@ class Relation (object): newt = relation() newt.header = Header(self.header) - c_expr = compile(expr, 'selection', 'eval') + try: + c_expr = compile(expr, 'selection', 'eval') + except: + raise Exception('Failed to compile expression: %s' % expr) for i in self.content: # Fills the attributes dictionary with the values of the tuple