mirror of
https://github.com/Textualize/rich.git
synced 2025-07-08 05:05:03 +00:00
tests
This commit is contained in:
parent
1b49c9fd92
commit
e96d889beb
7 changed files with 174 additions and 42 deletions
25
examples/recursive_error.py
Normal file
25
examples/recursive_error.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
"""
|
||||
|
||||
Demonstrates Rich tracebacks for recursion errors.
|
||||
|
||||
Rich can exclude frames in the middle to avoid huge tracebacks.
|
||||
|
||||
"""
|
||||
|
||||
from rich.console import Console
|
||||
|
||||
|
||||
def foo(n):
|
||||
return bar(n)
|
||||
|
||||
|
||||
def bar(n):
|
||||
return foo(n)
|
||||
|
||||
|
||||
console = Console()
|
||||
|
||||
try:
|
||||
foo(1)
|
||||
except Exception:
|
||||
console.print_exception(max_frames=20)
|
Loading…
Add table
Add a link
Reference in a new issue