Skip to content

Commit

Permalink
Do not log an error when NVS namespace is missing on read
Browse files Browse the repository at this point in the history
  • Loading branch information
lptr committed Dec 15, 2024
1 parent 79e5a04 commit 13edaef
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions main/kernel/NvsStore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,18 @@ class NvsStore {

nvs_handle_t handle;
esp_err_t err = nvs_open(name.c_str(), readOnly ? NVS_READONLY : NVS_READWRITE, &handle);
if (err != ESP_OK) {
LOGTE("nvs", "failed to %s '%s'", readOnly ? "read" : "write", name.c_str());
return false;
switch (err) {
case ESP_OK:
break;
case ESP_ERR_NVS_NOT_FOUND:
LOGTV("nvs", "namespace '%s' does not exist yet, nothing to read",
name.c_str());
return ESP_ERR_NOT_FOUND;
break;
default:
LOGTW("nvs", "failed to open NVS to %s '%s': %s",
readOnly ? "read" : "write", name.c_str(), esp_err_to_name(err));
break;
}

esp_err_t result = action(handle);
Expand Down

0 comments on commit 13edaef

Please sign in to comment.