Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit 57f9e04

Browse files
authored
Merge pull request #142 from pycom/nvs_too_long
modpycom: clarify error for too long nvs key
2 parents 7e14299 + 2801459 commit 57f9e04

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

esp32/mods/modpycom.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,10 @@ STATIC mp_obj_t mod_pycom_nvs_set (mp_obj_t _key, mp_obj_t _value) {
279279
nvs_commit(pycom_nvs_handle);
280280
} else if (ESP_ERR_NVS_NOT_ENOUGH_SPACE == esp_err || ESP_ERR_NVS_PAGE_FULL == esp_err || ESP_ERR_NVS_NO_FREE_PAGES == esp_err) {
281281
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, "No free space available"));
282-
} else if (ESP_ERR_NVS_INVALID_NAME == esp_err || ESP_ERR_NVS_KEY_TOO_LONG == esp_err) {
282+
} else if (ESP_ERR_NVS_INVALID_NAME == esp_err) {
283283
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "Key is invalid"));
284+
} else if (ESP_ERR_NVS_KEY_TOO_LONG == esp_err) {
285+
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "Key is too long"));
284286
} else {
285287
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_Exception, "Error occurred while storing value, code: %d", esp_err));
286288
}

0 commit comments

Comments
 (0)