summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Gatti <a.gatti@frob.it>2025-03-28 15:30:29 +0100
committerDamien George <damien@micropython.org>2025-05-15 11:29:41 +1000
commit24065824796b54d42fdb93457bf53d21656e473e (patch)
tree8c1a84f549298461a7285f3862e51cc5388908c7
parent155fa94fbf6afda9dbb3b8508c093648b5bffa09 (diff)
esp32/network_common: Raise a memory error on ESP_ERR_NO_MEM.
This commit changes the error handler for WiFi operations to recognise out of memory conditions reported by ESP-IDF functions, and report them as more descriptive exceptions rather than a generic "error 0x101". The error handler only provided a human-readable error description for WiFi-specific error codes (codes in the ESP_ERR_WIFI_BASE range), but WiFi functions are known to return other codes. Now ESP_ERR_NO_MEM is covered with a specific error message, making it easier to debug issues related to running out of ESP-IDF heap. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
-rw-r--r--ports/esp32/network_common.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ports/esp32/network_common.c b/ports/esp32/network_common.c
index e07d7a993..bd34f1b41 100644
--- a/ports/esp32/network_common.c
+++ b/ports/esp32/network_common.c
@@ -77,6 +77,8 @@ MP_NORETURN void esp_exceptions_helper(esp_err_t e) {
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("Wifi Would Block"));
case ESP_ERR_WIFI_NOT_CONNECT:
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("Wifi Not Connected"));
+ case ESP_ERR_NO_MEM:
+ mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("WiFi Out of Memory"));
default:
mp_raise_msg_varg(&mp_type_RuntimeError, MP_ERROR_TEXT("Wifi Unknown Error 0x%04x"), e);
}