Skip to content

Commit

Permalink
more changes for #133 and exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
newville committed Sep 23, 2024
1 parent 84ed2f3 commit 84ab7d7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion asteval/asteval.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,9 @@ def raise_exception(self, node, exc=None, msg='', expr=None, lineno=None):
if self.error_msg is None:
self.error_msg = msg
elif len(msg) > 0:
self.error_msg = f"{exc:s}: {msg}"
pass
# if err.exc is not None:
# self.error_msg = f"{err.exc.__name__}: {msg}"
if exc is None:
exc = self.error[-1].exc
if exc is None and len(self.error) > 0:
Expand Down Expand Up @@ -315,6 +317,7 @@ def eval(self, expr, lineno=0, show_errors=True, raise_errors=False):
"""Evaluate a single statement."""
self.lineno = lineno
self.error = []
self.error_msg = None
self.start_time = time.time()
if isinstance(expr, str):
try:
Expand Down

0 comments on commit 84ab7d7

Please sign in to comment.