fix: request() wraps bare asyncio.TimeoutError on total-timeout (v0.1.3)
broaden the except to (aiohttp.ClientError, asyncio.TimeoutError) and re-wrap into the same typed aiohttp.ClientError path. a total ClientTimeout raises a bare asyncio.TimeoutError, which is NOT an aiohttp.ClientError subclass, so it previously leaked raw out of request()/test_proxies(). add the missing asyncio import. Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
parent
d527174a2b
commit
9cb0c21970
@ -11,13 +11,13 @@ and swap the HTTP client while inheriting everything else.
|
||||
`requirements.txt`:
|
||||
|
||||
```
|
||||
aioweb @ git+ssh://git@git.rethinkstudios.io/rethink-public/aioweb.git@v0.1.2
|
||||
aioweb @ git+ssh://git@git.rethinkstudios.io/rethink-public/aioweb.git@v0.1.3
|
||||
```
|
||||
|
||||
Direct:
|
||||
|
||||
```bash
|
||||
pip install "aioweb @ git+ssh://git@git.rethinkstudios.io/rethink-public/aioweb.git@v0.1.2"
|
||||
pip install "aioweb @ git+ssh://git@git.rethinkstudios.io/rethink-public/aioweb.git@v0.1.3"
|
||||
```
|
||||
|
||||
Requires `aiohttp` and `yarl` (pulled transitively).
|
||||
|
||||
@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "aioweb"
|
||||
version = "0.1.2"
|
||||
version = "0.1.3"
|
||||
description = "Async HTTP session wrapper over aiohttp — proxies, header overwrites, retries, previews. Config-free, installable."
|
||||
requires-python = ">=3.10"
|
||||
dependencies = [
|
||||
|
||||
@ -17,6 +17,7 @@ sessions must be closed explicitly (async with, or await s.close()); there is no
|
||||
__del__ auto-close (that pattern is unsafe for async resources).
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import warnings
|
||||
|
||||
@ -312,7 +313,10 @@ class ExtendedSession:
|
||||
if debug and result.redirect_chain:
|
||||
log.info("redirect chain: %s", result.redirect_chain)
|
||||
return result
|
||||
except aiohttp.ClientError as error:
|
||||
except (aiohttp.ClientError, asyncio.TimeoutError) as error:
|
||||
# a total ClientTimeout raises a bare asyncio.TimeoutError, which is NOT an
|
||||
# aiohttp.ClientError subclass — wrap it into the same typed path so direct
|
||||
# callers get a consistent failure instead of a raw timeout
|
||||
raise aiohttp.ClientError(f"client error for {url}: {error}") from error
|
||||
|
||||
async def request_with_retries(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user