From 059c848d3d731a73dcb2e196d03200bb64c77740 Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Tue, 21 Jul 2026 20:13:27 -0400 Subject: [PATCH] Add more detailed error messages for the RB assignment --- notes-and-examples/2026.07.01/red_black_tree.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/notes-and-examples/2026.07.01/red_black_tree.py b/notes-and-examples/2026.07.01/red_black_tree.py index 8df2bcd..bb74a9e 100644 --- a/notes-and-examples/2026.07.01/red_black_tree.py +++ b/notes-and-examples/2026.07.01/red_black_tree.py @@ -1,3 +1,5 @@ +import traceback + class Node: def __init__(self, value, left=None, right=None, parent=None, is_red=False): self.value = value @@ -451,8 +453,10 @@ def run_tests(): print(" Your rebalance likely created a cycle or otherwise broke the") print(" tree structure (a child pointing back up at an ancestor).\n") continue - except Exception as e: - print(f" RESULT: ERROR - {type(e).__name__}: {e}\n") + except Exception: + print(f" RESULT: ERROR - see stack trace below\n") + print(traceback.format_exc()) + print("") continue # Guard the author (you) against a typo when adding a new case: the