summaryrefslogtreecommitdiffstats
path: root/docs/source/traceback.rst
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 20:18:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 20:18:28 +0000
commitf8363b456f1ab31ee56abad579b215af195093d5 (patch)
treeb1500c675c2e0a55fb75721a854e1510acf7c862 /docs/source/traceback.rst
parentInitial commit. (diff)
downloadrich-f8363b456f1ab31ee56abad579b215af195093d5.tar.xz
rich-f8363b456f1ab31ee56abad579b215af195093d5.zip
Adding upstream version 9.11.0.upstream/9.11.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'docs/source/traceback.rst')
-rw-r--r--docs/source/traceback.rst26
1 files changed, 26 insertions, 0 deletions
diff --git a/docs/source/traceback.rst b/docs/source/traceback.rst
new file mode 100644
index 0000000..f1d46e3
--- /dev/null
+++ b/docs/source/traceback.rst
@@ -0,0 +1,26 @@
+Traceback
+=========
+
+Rich can render Python tracebacks with syntax highlighting and formatting. Rich tracebacks are easier to read, and show more code, than standard Python tracebacks.
+
+
+Printing tracebacks
+-------------------
+
+The :meth:`~rich.console.Console.print_exception` method will print a traceback for the current exception being handled. Here's an example::
+
+ try:
+ do_something()
+ except:
+ console.print_exception()
+
+
+Traceback handler
+-----------------
+
+Rich can be installed as the default traceback handler so that all uncaught exceptions will be rendered with highlighting. Here's how::
+
+ from rich.traceback import install
+ install()
+
+There are a few options to configure the traceback handler, see :func:`~rich.traceback.install` for details. \ No newline at end of file