Skip to content

Commit 2af7bd6

Browse files
Stack trace reporting when there's a parse error
1 parent cf600c0 commit 2af7bd6

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

accelforge/util/_eval_expressions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import math
66
import re
77
import threading
8+
import traceback
89
from typing import Any, Callable
910
from ._yaml import load_yaml, SCRIPTS_FROM
1011
from ruamel.yaml.scalarstring import DoubleQuotedScalarString, SingleQuotedScalarString
@@ -231,6 +232,7 @@ def eval_expression(
231232
elif location:
232233
extra = f" while parsing {location}"
233234
errstr += f"Problem encountered{extra}: {e.__class__.__name__}: {e}\n"
235+
errstr += f"Stack trace:\n{''.join(traceback.format_tb(e.__traceback__))}\n"
234236
err = errstr
235237
errstr += f"Symbol table: "
236238
bindings = {}

0 commit comments

Comments
 (0)