Handle not_found in update().
This commit is contained in:
parent
e154e42771
commit
48c5fc3f6c
1 changed files with 4 additions and 1 deletions
|
@ -178,7 +178,10 @@ update(Db, Key, Fun) ->
|
||||||
|
|
||||||
update(Db, Key, Fun, Args) ->
|
update(Db, Key, Fun, Args) ->
|
||||||
F = fun() ->
|
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
|
NewValue = case Args of
|
||||||
undefined -> Fun(Key, Value);
|
undefined -> Fun(Key, Value);
|
||||||
Args -> Fun(Key, Value, Args)
|
Args -> Fun(Key, Value, Args)
|
||||||
|
|
Loading…
Reference in a new issue