summaryrefslogtreecommitdiffstats
path: root/docs/source/traceback.rst
diff options
context:
space:
mode:
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