From ae78b3b14d88a65535197181104ac41977e19497 Mon Sep 17 00:00:00 2001 From: Davide Bettio Date: Sun, 13 Aug 2023 11:56:09 +0200 Subject: [PATCH] ESP32/NVS: return namespace_not_found as undefined in get function namespace not found is quite common in a newly flash device, for consistency reasons it should be returned as undefined. Signed-off-by: Davide Bettio --- libs/eavmlib/src/esp.erl | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/eavmlib/src/esp.erl b/libs/eavmlib/src/esp.erl index 332218ef15..2315f729ab 100644 --- a/libs/eavmlib/src/esp.erl +++ b/libs/eavmlib/src/esp.erl @@ -180,6 +180,7 @@ nvs_get_binary(Namespace, Key) when is_atom(Namespace) andalso is_atom(Key) -> case esp:nvs_fetch_binary(Namespace, Key) of {ok, Result} -> Result; {error, not_found} -> undefined; + {error, namespace_not_found} -> undefined; {error, OtherError} -> throw(OtherError) end.