Skip to content

Commit 3f9fe23

Browse files
authored
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.
1 parent 801165e commit 3f9fe23

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Doc/tutorial/errors.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -281,17 +281,17 @@ chaining exceptions. For example::
281281
This can be useful when you are transforming exceptions. For example::
282282

283283
>>> def func():
284-
... raise IOError
284+
... raise ConnectionError
285285
...
286286
>>> try:
287287
... func()
288-
... except IOError as exc:
288+
... except ConnectionError as exc:
289289
... raise RuntimeError('Failed to open database') from exc
290290
...
291291
Traceback (most recent call last):
292292
File "<stdin>", line 2, in <module>
293293
File "<stdin>", line 2, in func
294-
OSError
294+
ConnectionError
295295
<BLANKLINE>
296296
The above exception was the direct cause of the following exception:
297297
<BLANKLINE>
@@ -300,7 +300,7 @@ This can be useful when you are transforming exceptions. For example::
300300
RuntimeError: Failed to open database
301301

302302
Exception chaining happens automatically when an exception is raised inside an
303-
:keyword:`except` or :keyword:`finally` section. Exception chaining can be
303+
:keyword:`except` or :keyword:`finally` section. This can be
304304
disabled by using ``from None`` idiom:
305305

306306
>>> try:

0 commit comments

Comments
 (0)