Skip to content
This repository has been archived by the owner on Sep 19, 2019. It is now read-only.

Commit

Permalink
Handling missing docs when using 'linked documents'
Browse files Browse the repository at this point in the history
fabric_view:possibly_embed_doc assumes the referenced doc exists and throws
badmatch if not. So I fixed that.

BugzID: 12535
  • Loading branch information
Robert Newson committed Aug 12, 2011
1 parent 578edd8 commit d609ef4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/fabric_view.erl
Expand Up @@ -164,11 +164,14 @@ possibly_embed_doc(#collector{db_name=DbName, query_args=Args},
% to not interfere with current call
{Pid, Ref} = spawn_monitor(fun() ->
exit(fabric:open_doc(DbName, IncId, [])) end),
{ok, NewDoc} =
receive {'DOWN',Ref,process,Pid, Resp} ->
case receive {'DOWN',Ref,process,Pid, Resp} ->
Resp
end,
Row#view_row{doc=couch_doc:to_json_obj(NewDoc,[])}
end of
{ok, NewDoc} ->
Row#view_row{doc=couch_doc:to_json_obj(NewDoc,[])};
{not_found, missing} ->
Row#view_row{doc=null}
end
end;
_ -> Row
end.
Expand Down

0 comments on commit d609ef4

Please sign in to comment.