Skip to content

Commit 8f3b9f4

Browse files
committed
Merge pull request #755 from bettio/handle-ns-not-found
ESP32/NVS: return `namespace_not_found` as `undefined` in get function Fixes `nvs_get_binary/2` so it can work on devices with a completely erased NVS area. namespace not found is quite common in a newly flash device, for consistency reasons it should be returned as undefined. These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
2 parents abb9ea2 + ae78b3b commit 8f3b9f4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

libs/eavmlib/src/esp.erl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ nvs_get_binary(Namespace, Key) when is_atom(Namespace) andalso is_atom(Key) ->
180180
case esp:nvs_fetch_binary(Namespace, Key) of
181181
{ok, Result} -> Result;
182182
{error, not_found} -> undefined;
183+
{error, namespace_not_found} -> undefined;
183184
{error, OtherError} -> throw(OtherError)
184185
end.
185186

0 commit comments

Comments
 (0)