Skip to content

fix: wrap socket.error exceptions in ConnectionError#81

Open
label-hook[bot] wants to merge 1391 commits into
mainfrom
phoenix/issue-80
Open

fix: wrap socket.error exceptions in ConnectionError#81
label-hook[bot] wants to merge 1391 commits into
mainfrom
phoenix/issue-80

Conversation

@label-hook

@label-hook label-hook Bot commented Apr 13, 2026

Copy link
Copy Markdown

Summary

This PR fixes an issue where raw socket.error exceptions were not being caught and wrapped in appropriate requests exceptions. Now socket.error exceptions are properly caught and wrapped in requests.ConnectionError to provide a consistent exception interface for users of the requests library.

Changes

  • Added socket.error to the exception handling in HTTPAdapter.send() method in requests/adapters.py
  • Raw socket errors are now wrapped in ConnectionError with the original exception as the cause
  • This ensures users receive consistent requests exceptions rather than low-level socket exceptions

Testing

The change was tested by running the existing test suite to ensure no regressions were introduced. The baseline test suite had pre-existing failures that were unrelated to this change, and no new test failures were introduced by this modification.

Closes #80


Closes #80

Lukasa and others added 30 commits January 9, 2014 19:50
Fixed parsing of username and password encoded in the URI
Document contextlib.closing.
Add a small note about requests-toolbelt
Added info about posted files headers
Fix for 301 redirect and latest PyOpenSSL.
nonZero and others added 26 commits July 15, 2014 19:56
Update link to pip site on docs/user/install.rst
removed unneeded parentheses from if clause
A few instances of the directives were malformed and did not
result in hyperlinks in the generated HTML.

Change-Id: I94d93de928ee4ff24a48797baf2ac77598a20704
…tives

Docs: Fix :class: and :meth: directives
Change-Id: Ied3e600e5673eff48558b634b3c2616d13a3337b
Change-Id: Ic1464f246602b809f3c29fbafd6f36b747d5d5df
Change-Id: Ie38844a40ec7a483e6ce5e56077be344242bcd99
Change-Id: Ic03aa394941367745f3148d299b5313849f77051
The file is empty and not linked from anywhere, resulting in
a warning when building the docs.

Change-Id: Ib995d094ef525496fe8b2a369e0a0c5b4c7bd2dd
Change-Id: I950c3da727fb97b58d96a872b0d2ed718cc60ba8
- Linkify github usernames
- Remove usernames that do not exist

Change-Id: Ib88b70a3010e915b3570ae5062c8cb416c9a6462
Change-Id: Ic88eb128384b3cc9108151c219cd759c7524a4f1
Docs: Using print() function instead print command on advanced & quickstart
Linkify Github usernames in authors list
Removed an unnecessary "to" in the "What are "hostname doesn't match" errors?" section.
Revised wording based on feedback from @sigmavirus24
@label-hook label-hook Bot added the ai:review Phoenix AI: PR ready for review label Apr 13, 2026
@kkipngenokoech kkipngenokoech force-pushed the main branch 2 times, most recently from 36453b9 to a0df2cb Compare April 18, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai:review Phoenix AI: PR ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SWE-bench] psf__requests-2148