diff options
author | Vladimir <greatvovan@gmail.com> | 2020-12-16 02:47:26 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-16 02:47:26 (GMT) |
commit | 3f9fe23c05280dc5736c07bb0e968cdaf8c503d0 (patch) | |
tree | 19f1cf350835186408cf2f44c6ffa53d5cefe062 /Doc/tutorial/errors.rst | |
parent | 801165e1a99507d604d4db82e44b1cab9f9c715c (diff) | |
download | cpython-3f9fe23c05280dc5736c07bb0e968cdaf8c503d0.zip cpython-3f9fe23c05280dc5736c07bb0e968cdaf8c503d0.tar.gz cpython-3f9fe23c05280dc5736c07bb0e968cdaf8c503d0.tar.bz2 |
bpo-42179: Clarify exception chaining (GH-23160)
* Update errors.rst
Clarify exception chaining behaviour and give a reference to the library documentation.
* Update errors.rst
Wording
* Update errors.rst
Spelling
* Update errors.rst
Remove mentioning of special attributes as folks think it's too much for beginners.
Diffstat (limited to 'Doc/tutorial/errors.rst')
-rw-r--r-- | Doc/tutorial/errors.rst | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Doc/tutorial/errors.rst b/Doc/tutorial/errors.rst index efe44da..4a25861 100644 --- a/Doc/tutorial/errors.rst +++ b/Doc/tutorial/errors.rst @@ -281,17 +281,17 @@ chaining exceptions. For example:: This can be useful when you are transforming exceptions. For example:: >>> def func(): - ... raise IOError + ... raise ConnectionError ... >>> try: ... func() - ... except IOError as exc: + ... except ConnectionError as exc: ... raise RuntimeError('Failed to open database') from exc ... Traceback (most recent call last): File "<stdin>", line 2, in <module> File "<stdin>", line 2, in func - OSError + ConnectionError <BLANKLINE> The above exception was the direct cause of the following exception: <BLANKLINE> @@ -300,7 +300,7 @@ This can be useful when you are transforming exceptions. For example:: RuntimeError: Failed to open database Exception chaining happens automatically when an exception is raised inside an -:keyword:`except` or :keyword:`finally` section. Exception chaining can be +:keyword:`except` or :keyword:`finally` section. This can be disabled by using ``from None`` idiom: >>> try: |