adafruit / adafruit/Adafruit_CircuitPython_Requests
Connection Manager get_socket() will return exception without message
- Dominant language
- Python
- Stars
- 49
- Forks
- 39
- PR merge metrics
- No merged PRs in 30d
Description
In def request() line 633 I am getting an exception thrown at
`socket = self._connection_manager.get_socket(`
however there is no message with the exception making it difficult to know why its failing.
This is on a Pico W and most likely due to an API call that is too large *my best guess* and so I would recommend adding a try and when the exception is thrown checking if the message is blank and adding one to the throw so the call to the request knows where it failed.
Something along the lines of
```
while retry_count < 2:
retry_count += 1
try:
socket = self._connection_manager.get_socket(
host,
port,
proto,
session_id=self._session_id,
timeout=timeout,
ssl_context=self._ssl_context,
)
except Exception as exc:
print('connection_manager.get_socket',exc)
# raise exception but add message if its empty
if not str(exc):
raise RuntimeError("Failed to get socket") from exc
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in def request() around line 633 and inspect the self._connection_manager.get_socket() call, especially how exceptions with empty messages are handled. Reproduce the Pico W failure if possible, then verify that socket errors retain existing messages and receive a useful message when the original is blank.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100