Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix stack trace parsing error #265

Merged
merged 1 commit into from
Mar 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions py5_resources/py5_module/py5/bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ def handle_exception(println, exc_type, exc_value, exc_tb):
tb = exc_tb.tb_next
while hasattr(tb, 'tb_next') and hasattr(tb, 'tb_frame'):
f_code = tb.tb_frame.f_code
if f_code.co_filename.startswith(_MODULE_INSTALL_DIR) and not f_code.co_name.contains('py5_no_prune'):
if f_code.co_filename.startswith(_MODULE_INSTALL_DIR) and not f_code.co_name.endswith('py5_no_prune'):
py5info.append((Path(f_code.co_filename[(len(_MODULE_INSTALL_DIR) + 1):]).parts,
f_code.co_name))
if trim_tb is None:
trim_tb = prev_tb
elif f_code.co_filename.startswith(_PY5TOOLS_MODULE_INSTALL_DIR) and not f_code.co_name.contains('py5_no_prune'):
elif f_code.co_filename.startswith(_PY5TOOLS_MODULE_INSTALL_DIR) and not f_code.co_name.endswith('py5_no_prune'):
py5info.append((Path(f_code.co_filename[(len(_PY5TOOLS_MODULE_INSTALL_DIR) + 1):]).parts,
f_code.co_name))
if trim_tb is None:
Expand All @@ -122,7 +122,7 @@ def handle_exception(println, exc_type, exc_value, exc_tb):
while m := _PY5_STATIC_CODE_FILENAME_REGEX.search(errmsg):
errmsg = errmsg[m.span()[1]:]
else:
errmsg = "py5 encountered an error in your code:" + errmsg
errmsg = "py5 encountered an error in your code:\n\n" + errmsg

println(errmsg, stderr=True)

Expand Down