Skip to content

Commit 2406582

Browse files
agattidpgeorge
authored andcommitted
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 <[email protected]>
1 parent 155fa94 commit 2406582

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ports/esp32/network_common.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ MP_NORETURN void esp_exceptions_helper(esp_err_t e) {
7777
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("Wifi Would Block"));
7878
case ESP_ERR_WIFI_NOT_CONNECT:
7979
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("Wifi Not Connected"));
80+
case ESP_ERR_NO_MEM:
81+
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("WiFi Out of Memory"));
8082
default:
8183
mp_raise_msg_varg(&mp_type_RuntimeError, MP_ERROR_TEXT("Wifi Unknown Error 0x%04x"), e);
8284
}

0 commit comments

Comments
 (0)