Closed anecdata closed 3 years ago
@anecdata I have a question..since this eventually raises OutOfRetries
if we cant obtain a socket, do we want to pass some "out of sockets" RuntimeError text to OutOfRetries
? Currently it's just raising which isn't descriptive about why it failed.
It seems to be transient timeouts that recover naturally, but more info is better. I know nothing about custom exceptions, but I'm sure I can find an example somewhere. New commit forthcoming.
Managed to catch it in testing:
Traceback (most recent call last):
File "code.py", line 663, in http_get
File "/lib/adafruit_requests.py", line 598, in get
File "/lib/adafruit_requests.py", line 583, in request
OutOfRetries: Repeated socket failures
An
ETIMEDOUT
exception occurring on asocket.recv_into
call in a Session request would leave the socket open, and after two occurrences, would getRuntimeError: Out of sockets
and require a microcontroller reset.After this change, if the failure persists, it will raise an
OutOfRetries:
exception, just as in the case of persistent_send_request
failures.