Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinier Heeres <reinier@heeres.eu>2009-03-12 21:56:18 (GMT)
committer Reinier Heeres <reinier@heeres.eu>2009-03-12 21:56:18 (GMT)
commita3dcc8d14eef9fffbacfa833f12e3ba1e9f5ced2 (patch)
tree63431160ecae0ddfabdd2d146f603cd3c45c201d
parente5df6bba0b82e295c125c585a5a6bf2397f6b30e (diff)
Catch exceptions in AstParser (report Internal error)
-rw-r--r--astparser.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/astparser.py b/astparser.py
index 93dd224..a33484d 100644
--- a/astparser.py
+++ b/astparser.py
@@ -197,7 +197,6 @@ class AstParser:
ast.LShift: 'shift_left',
ast.Mod: 'mod',
ast.Mult: 'mul',
- ast.NotEq: lambda x, y: x != y,
ast.Or: lambda x, y: x or y,
ast.Pow: 'pow',
ast.RShift: 'shift_right',
@@ -582,10 +581,15 @@ class AstParser:
eqn = self.parse(eqn)
state = EvalState()
- if isinstance(eqn, ast.Expression):
- ret = self._process_node(eqn.body, state)
- else:
- ret = self._process_node(eqn, state)
+ try:
+ if isinstance(eqn, ast.Expression):
+ ret = self._process_node(eqn.body, state)
+ else:
+ ret = self._process_node(eqn, state)
+ except Exception, e:
+ logging.error('Internal error (%s): %s', type(e), str(e))
+ msg = _('Internal error')
+ raise ParseError(msg, 0)
self._used_var_ofs = state.used_var_ofs