PEP-654: errors --> exceptions (#1871)

This commit is contained in:
Irit Katriel 2021-03-15 20:17:05 +00:00 committed by GitHub
parent a49056a590
commit 31d814345e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -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
@ -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
@ -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: