Skip to content

Commit

Permalink
PEP-654: errors --> exceptions (#1871)
Browse files Browse the repository at this point in the history
  • Loading branch information
iritkatriel authored Mar 15, 2021
1 parent a49056a commit 31d8143
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pep-0654.rst
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ and ``try: ... except BaseExceptionGroup: ...``.

Both have a constructor that takes two positional-only arguments: a message
string and a sequence of the nested exceptions, which are exposed in the
fields ``message`` and ``errors``. For example:
fields ``message`` and ``exceptions``. For example:
``ExceptionGroup('issues', [ValueError('bad value'), TypeError('bad type')])``.
The difference between them is that ``ExceptionGroup`` can only wrap
``Exception`` subclasses while ``BaseExceptionGroup`` can wrap any
Expand Down Expand Up @@ -383,7 +383,7 @@ recursively, as follows:
tbs.append(exc.__traceback__)
if isinstance(exc, ExceptionGroup):
for e in exc.errors:
for e in exc.exceptions:
yield from leaf_generator(e, tbs)
else:
# exc is a leaf exception and its traceback
Expand Down Expand Up @@ -491,7 +491,7 @@ Exceptions are matched using a subclass check. For example:
try:
low_level_os_operation()
except *OSError as eg:
for e in eg.errors:
for e in eg.exceptions:
print(type(e).__name__)
could output:
Expand Down

0 comments on commit 31d8143

Please sign in to comment.