added first_error for asyncio task groups

This commit is contained in:
TPV committed 2026-07-27 10:23:07 -07:00
1 parent 763f40988f
commit b6cd692258
1 file changed
+9
+9
View File
@@ -553,3 +553,12 @@ async def retry_failed_pages(
retry_attempt += 1
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