From b16026756861facfb7fc2c362f8a0ea276590162 Mon Sep 17 00:00:00 2001 From: Justin Myers Date: Mon, 20 May 2024 22:31:10 -0700 Subject: [PATCH] Remove timeout Exception --- adafruit_esp32spi/adafruit_esp32spi_socketpool.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/adafruit_esp32spi/adafruit_esp32spi_socketpool.py b/adafruit_esp32spi/adafruit_esp32spi_socketpool.py index 1540c88..6d8a32e 100644 --- a/adafruit_esp32spi/adafruit_esp32spi_socketpool.py +++ b/adafruit_esp32spi/adafruit_esp32spi_socketpool.py @@ -21,6 +21,7 @@ pass +import errno import time import gc from micropython import const @@ -181,7 +182,7 @@ def recv_into(self, buffer, nbytes: int = 0): break # No bytes yet, or more bytes requested. if self._timeout > 0 and time.monotonic() - last_read_time > self._timeout: - raise timeout("timed out") + raise OSError(errno.ETIMEDOUT) return num_read def settimeout(self, value): @@ -223,11 +224,3 @@ def _connected(self): def close(self): """Close the socket, after reading whatever remains""" self._interface.socket_close(self._socknum) - - -class timeout(TimeoutError): # pylint: disable=invalid-name - """TimeoutError class. An instance of this error will be raised by recv_into() if - the timeout has elapsed and we haven't received any data yet.""" - - def __init__(self, msg): - super().__init__(msg)