Add more detailed error messages for the RB assignment
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user