You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 08ced9c
Browse filesBrowse the repository at this point in the historyBrowse files
fix(errors): correct NetworkError docstring — close, not pool
PoolTimeout inherits from httpx2.TimeoutException, not NetworkError, so
the bucket is connect/read/write/close. The dispatch logic is unchanged
(PoolTimeout was already caught by the timeout branch above NetworkError),
but the docstring was misleading future maintainers and the upcoming Retry
middleware author about what NetworkError actually wraps.
Update spec + plan to match.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Edit `src/httpware/errors.py`. Add a new class immediately after the existing `class TransportError`:
140
140
```python
141
141
classNetworkError(TransportError):
142
-
"""Transient network-layer failure (connect/read/write/pool). Safe to retry."""
142
+
"""Transient network-layer failure (connect/read/write/close). Safe to retry.
143
+
144
+
Pool-acquisition timeouts are NOT under this class; they raise ``TimeoutError``
145
+
via ``httpx2.PoolTimeout`` (a ``TimeoutException`` subclass).
146
+
"""
143
147
```
144
148
145
149
Run: `uv run pytest tests/test_errors.py::test_network_error_is_transport_error -v`
@@ -220,7 +224,7 @@ Becomes:
220
224
221
225
The `httpx2.NetworkError` branch must come BEFORE `httpx2.HTTPError` (HTTPError is the broader base). `httpx2.NetworkError` is httpx's documented base for `ConnectError`, `ReadError`, `WriteError`, `PoolTimeout` — if `httpx2`'s symbol name differs (e.g., `httpx2.exceptions.NetworkError`), use whichever import path mirrors the existing `httpx2.ConnectError` import in `tests/test_error_mapping_terminal.py` (which works via top-level `httpx2`).
222
226
223
-
If `httpx2.NetworkError` does not exist, fall back to enumerating the transient subset explicitly: `except (httpx2.ConnectError, httpx2.ReadError, httpx2.WriteError, httpx2.PoolTimeout) as exc:`. The plan author has confirmed `httpx2.ConnectError` and `httpx2.ReadTimeout` already work in the existing tests; the enumeration fallback is safe.
227
+
If `httpx2.NetworkError` does not exist, fall back to enumerating the transient subset explicitly: `except (httpx2.ConnectError, httpx2.ReadError, httpx2.WriteError, httpx2.CloseError) as exc:`. (`PoolTimeout` is NOT in this list — it inherits from `httpx2.TimeoutException` and is already caught by the timeout branch above.) The plan author has confirmed `httpx2.ConnectError` and `httpx2.ReadTimeout` already work in the existing tests; the enumeration fallback is safe.
And refines the terminal mapping so that `httpx2`'s transient-network exception family (`httpx2.NetworkError` per httpx convention, or whichever symbols httpx2 exposes for the same hierarchy) raises `httpware.NetworkError` rather than the broader `TransportError`. `InvalidURL` and `CookieConflict` continue to raise `TransportError` directly so they are NOT retried. Existing tests catching `TransportError` keep working (`NetworkError` is a subclass).
0 commit comments