Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3f9fe23

Browse filesBrowse 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
Copy full SHA for 3f9fe23

File tree

Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed

‎Doc/tutorial/errors.rst

Copy file name to clipboardExpand all lines: Doc/tutorial/errors.rst
+4-4Lines changed: 4 additions & 4 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.