diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2021-12-03 22:01:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-03 22:01:15 (GMT) |
commit | 5bb7ef2768be5979b306e4c7552862b1746c251d (patch) | |
tree | 2c5d4d96a1e5bba8d0d918cc413d882f10308e63 /Doc/library/exceptions.rst | |
parent | d9301703fb1086cafbd730c17e3d450a192485d6 (diff) | |
download | cpython-5bb7ef2768be5979b306e4c7552862b1746c251d.zip cpython-5bb7ef2768be5979b306e4c7552862b1746c251d.tar.gz cpython-5bb7ef2768be5979b306e4c7552862b1746c251d.tar.bz2 |
bpo-45607: Make it possible to enrich exception displays via setting their __note__ field (GH-29880)
Diffstat (limited to 'Doc/library/exceptions.rst')
-rw-r--r-- | Doc/library/exceptions.rst | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst index 8fa82a9..12d7d8a 100644 --- a/Doc/library/exceptions.rst +++ b/Doc/library/exceptions.rst @@ -127,6 +127,14 @@ The following exceptions are used mostly as base classes for other exceptions. tb = sys.exc_info()[2] raise OtherException(...).with_traceback(tb) + .. attribute:: __note__ + + A mutable field which is :const:`None` by default and can be set to a string. + If it is not :const:`None`, it is included in the traceback. This field can + be used to enrich exceptions after they have been caught. + + .. versionadded:: 3.11 + .. exception:: Exception |