Skip to content

fix: wrap httpx timeouts as RequestTimeoutError#48

Draft
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/justllms-repository-improvements-50dd
Draft

fix: wrap httpx timeouts as RequestTimeoutError#48
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/justllms-repository-improvements-50dd

Conversation

@cursor

@cursor cursor Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes inconsistent timeout error handling in the HTTP layer.

justllms.exceptions.TimeoutError was defined but never raised — httpx timeouts bubbled up as raw httpx.TimeoutException instead. The class also shadowed Python's built-in TimeoutError.

Changes

  • Introduce RequestTimeoutError as the canonical timeout exception
  • Keep TimeoutError as a backwards-compatible alias
  • Add raise_from_httpx_error() helper to map httpx transport errors to library exceptions
  • Wrap timeouts in BaseProvider._make_http_request() and parse_sse_stream()
  • Add tests in tests/test_http_errors.py

Branch

Feature branch: darshan/wrap-httpx-timeout-errors

Testing

All CI checks pass locally:

  • ruff check justllms/
  • black --check justllms/ tests/
  • mypy justllms/ --ignore-missing-imports
  • pytest tests/ -v (100 passed)
  • python3 -m build
Open in Web View Automation 

cursoragent and others added 2 commits June 10, 2026 09:35
Rename the library timeout exception to RequestTimeoutError to avoid
shadowing Python's built-in TimeoutError, while keeping TimeoutError as
a backwards-compatible alias.

HTTP and streaming layers now convert httpx.TimeoutException into
RequestTimeoutError so callers and failover logic get a consistent,
typed timeout error instead of raw httpx exceptions.

Co-authored-by: Darshan Harihar <DarshanHarihar1@users.noreply.github.com>
Co-authored-by: Darshan Harihar <DarshanHarihar1@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant