Skip to content

Commit

Permalink
show runtime errors in native list functions
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1042260 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
janl committed Dec 4, 2010
1 parent cd461f2 commit 45837ab
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/couchdb/couch_native_process.erl
Expand Up @@ -186,7 +186,14 @@ ddoc(State, {DDoc}, [FunPath, Args]) ->
ddoc(State, {_, Fun}, [<<"validate_doc_update">>], Args) ->
{State, (catch apply(Fun, Args))};
ddoc(State, {_, Fun}, [<<"filters">>|_], [Docs, Req]) ->
Resp = lists:map(fun(Doc) -> (catch Fun(Doc, Req)) =:= true end, Docs),
FilterFunWrapper = fun(Doc) ->
case catch Fun(Doc, Req) of
true -> true;
false -> false;
{'EXIT', Error} -> ?LOG_ERROR("~p", [Error])
end
end,
Resp = lists:map(FilterFunWrapper, Docs),
{State, [true, Resp]};
ddoc(State, {_, Fun}, [<<"shows">>|_], Args) ->
Resp = case (catch apply(Fun, Args)) of
Expand Down

0 comments on commit 45837ab

Please sign in to comment.