Skip to content

fix: wrap socket.error exceptions in ConnectionError for consistent exception handling#66

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

fix: wrap socket.error exceptions in ConnectionError for consistent exception handling#66
label-hook[bot] wants to merge 1391 commits into
mainfrom
phoenix/issue-65

Conversation

@label-hook

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

Copy link
Copy Markdown

Summary

This PR addresses issue #65 where raw socket.error exceptions were being raised instead of being wrapped in requests.exceptions.ConnectionError. This change ensures consistent exception handling by wrapping socket-level errors in the appropriate requests exception type.

Changes

  • Modified HTTPAdapter.send() method in requests/adapters.py to catch socket.error exceptions
  • Added exception wrapping to convert socket.error to requests.exceptions.ConnectionError
  • Maintains the original exception as the cause for debugging purposes
  • Ensures all socket-level connection issues are presented as requests exceptions rather than raw socket errors

Testing

The changes were tested to ensure:

  • Socket errors are properly caught and wrapped in ConnectionError
  • Original exception information is preserved for debugging
  • No regression in existing functionality
  • Baseline test suite continues to pass (no new failures introduced)

Closes #65


Closes #65

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