added first_error for asyncio task groups
This commit is contained in:
1 parent
763f40988f
commit
b6cd692258
1 file changed
+9
@@ -553,3 +553,12 @@ async def retry_failed_pages(
|
|||||||
retry_attempt += 1
|
retry_attempt += 1
|
||||||
|
|
||||||
return failed_pages
|
return failed_pages
|
||||||
|
|
||||||
|
|
||||||
|
def first_error(group_exc: BaseExceptionGroup) -> BaseException:
|
||||||
|
"""Return the first leaf exception of a possibly nested exception group."""
|
||||||
|
error = group_exc.exceptions[0]
|
||||||
|
while isinstance(error, BaseExceptionGroup):
|
||||||
|
error = error.exceptions[0]
|
||||||
|
|
||||||
|
return error
|
||||||
Reference in new issue
Block a user