How to use rich Traceback with raise errors? #1461
-
I'm trying to use rich's Traceback with from rich.console import Console
console = Console()
def some_function(something):
if something == "foo":
do_something()
elif something == "bar":
do_something_else()
else:
console.print_exception(show_locals=True)
raise ValueError("You dun goofed.") I receive the error |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The print_exception method will only work when there is an exception to print, i.e. within an i.e. something like this: try:
some_function("foo")
except:
console.print_exception(show_locals=True) |
Beta Was this translation helpful? Give feedback.
The print_exception method will only work when there is an exception to print, i.e. within an
except:
block.i.e. something like this: