Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Add Else Clause For Embed Doc
When open_doc or open_revs return an error, we set the doc value
to be an error message. This way we account for errors rather than
transform_row throwing a function_clause.

COUCHDB-3109
  • Loading branch information
Tony Sun committed Feb 9, 2017
1 parent dd02a39 commit cf220b2e927093e3bd6f409b4ca9f7b1be0a04a3
Showing 1 changed file with 6 additions and 2 deletions.
@@ -172,15 +172,19 @@ possibly_embed_doc(#collector{db_name=DbName, query_args=Args},
{ok, NewDoc} ->
Row#view_row{doc=couch_doc:to_json_obj(NewDoc,[])};
{not_found, _} ->
Row#view_row{doc=null}
Row#view_row{doc=null};
Else ->
Row#view_row{doc={error, Else}}
end;
Rev0 ->
Rev = couch_doc:parse_rev(Rev0),
case fabric:open_revs(DbName, IncId, [Rev], []) of
{ok, [{ok, NewDoc}]} ->
Row#view_row{doc=couch_doc:to_json_obj(NewDoc,[])};
{ok, [{{not_found, _}, Rev}]} ->
Row#view_row{doc=null}
Row#view_row{doc=null};
Else ->
Row#view_row{doc={error, Else}}
end
end) end),
receive {'DOWN',Ref,process,Pid, Resp} ->

0 comments on commit cf220b2

Please sign in to comment.