Skip to content

Let httpx transport errors fall through to caller - #262

Merged
barbieri merged 1 commit into
profusion:masterfrom
kewisch:httpx
Oct 6, 2025
Merged

Let httpx transport errors fall through to caller#262
barbieri merged 1 commit into
profusion:masterfrom
kewisch:httpx

Conversation

@kewisch

@kewisch kewisch commented Oct 6, 2025

Copy link
Copy Markdown
Contributor

Fixes #261

I needed to add pytest to optional depdendencies since flake8-requirements will prefer PEP621 over poetry's groups and apparently PEP 735 is not yet supported. I get I900 'pytest' not listed as a requirement otherwise.

https://github.com/arkq/flake8-requirements/blob/30242fe4b86730b69816e2d4e0ac2b74894b6381/src/flake8_requirements/checker.py#L743

Please see open question in #261 but I wanted to get this off my chest in case this is your preferred solution

@coveralls

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 18281444430

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 17269740778: 0.0%
Covered Lines: 1687
Relevant Lines: 1687

💛 - Coveralls

@barbieri
barbieri requested a review from Copilot October 6, 2025 14:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes issue #261 by modifying the HTTPXEndpoint to let httpx transport errors propagate to the caller instead of being caught and handled internally. The change narrows the exception handling from httpx.HTTPError to httpx.HTTPStatusError, allowing transport-level errors like RemoteProtocolError to bubble up.

Key changes:

  • Modified exception handling in HTTPXEndpoint to catch only httpx.HTTPStatusError instead of the broader httpx.HTTPError
  • Added test coverage for transport error scenarios
  • Added pytest to optional dependencies to satisfy flake8-requirements

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
sgqlc/endpoint/httpx.py Changed exception handling from HTTPError to HTTPStatusError to allow transport errors to propagate
tests/test-endpoint-httpx.py Added test case and pytest import to verify transport errors bubble up to caller
pyproject.toml Added pytest as optional dependency for flake8-requirements compatibility

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.



def test_server_http_transport_error(respx_mock):
'Test if a transport error will get passed back to the caller'

Copilot AI Oct 6, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Function docstring should use triple quotes for multi-line format consistency with other test functions.

Suggested change
'Test if a transport error will get passed back to the caller'
"""Test if a transport error will get passed back to the caller"""

Copilot uses AI. Check for mistakes.
Comment thread sgqlc/endpoint/httpx.py
@barbieri
barbieri merged commit 910519c into profusion:master Oct 6, 2025
6 checks passed
@barbieri

barbieri commented Oct 6, 2025

Copy link
Copy Markdown
Member

thanks again, @kewisch! Released as https://pypi.org/project/sgqlc/17.1/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTTPX Endpoint: 'RemoteProtocolError' object has no attribute 'response'

4 participants