Skip to content

Commit

Permalink
Tune friendly traceback
Browse files Browse the repository at this point in the history
Always print the line contents as it just too confusing without it.
  • Loading branch information
kaste committed Dec 10, 2024
1 parent 7947986 commit 19d58f7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ def user_friendly_traceback(exception_s: type[BaseException] | tuple[type[BaseEx
found_culprit = False
for frame in reversed(traceback.extract_tb(tb)):
relative_filename = frame.filename.split(GITSAVVY__)[-1]
print(f"| {relative_filename}:{frame.lineno}")
if not found_culprit and relative_filename.startswith(CORE_COMMANDS__):
found_culprit = True
print(f"|> {frame.line}")
left_column = f"|> {relative_filename}:{frame.lineno}"
else:
left_column = f"| {relative_filename}:{frame.lineno}"
print(f"{left_column:<40} {frame.line}")


def it_runs_on_ui():
Expand Down

0 comments on commit 19d58f7

Please sign in to comment.