Handle not_found in update().

This commit is contained in:
Phillip Toland 2008-12-15 14:34:13 -06:00
parent e154e42771
commit 48c5fc3f6c

View file

@ -178,7 +178,10 @@ update(Db, Key, Fun) ->
update(Db, Key, Fun, Args) ->
F = fun() ->
{ok, Value} = get(Db, Key, [rmw]),
Value = case get(Db, Key, [rmw]) of
not_found -> not_found;
{ok, Val} -> Val
end,
NewValue = case Args of
undefined -> Fun(Key, Value);
Args -> Fun(Key, Value, Args)