Skip to content

Commit

Permalink
Fix relative_to usage
Browse files Browse the repository at this point in the history
  • Loading branch information
druzsan committed Feb 12, 2024
1 parent c7d10ff commit d66c91b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion renumics/spotlight/reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,11 @@ def _sanitize_traceback_exception(exc: traceback.TracebackException) -> None:
spotlight_frames: list = []
for frame in exc.stack:
filename = Path(frame.filename)
if filename.absolute() == filename.relative_to(spotlight_basepath).absolute():
try:
frame.filename = str(filename.relative_to(spotlight_basepath))
except ValueError:
pass
else:
spotlight_frames.append(frame)
exc.stack = traceback.StackSummary.from_list(spotlight_frames)
if exc.__cause__ is not None:
Expand Down

0 comments on commit d66c91b

Please sign in to comment.