Skip to content

Commit

Permalink
don't hide last frame if last frame is internal error
Browse files Browse the repository at this point in the history
  • Loading branch information
alvinwan committed Oct 26, 2021
1 parent fb76d4d commit 908501f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions iwut/__init__.py
Expand Up @@ -189,11 +189,13 @@ def filename_to_cell(filename):
def get_wut_traceback(etype, value, tb, tb_offset=0, name_to_meta=None):
lines = ["<div class='error-container'>"]
toggle = False
for frame in extract_tb(tb, name_to_meta)[tb_offset:]:
if 'site-packages' in frame.filename and not toggle:
frames = extract_tb(tb, name_to_meta)[tb_offset:]
for frame_idx, frame in enumerate(frames):
should_hide_frame = 'site-packages' in frame.filename and not (frame_idx == len(frames) - 1)
if should_hide_frame and not toggle:
lines.append('<details><summary><span class="ellipsis">&middot;&middot;&middot;</span></summary>')
toggle = True
elif 'site-packages' not in frame.filename and toggle:
elif not should_hide_frame and toggle:
lines.append('</details>')
toggle = False
filename = filename_to_cell(frame.filename)
Expand Down

0 comments on commit 908501f

Please sign in to comment.