You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ko...@apache.org on 2017/03/01 16:38:44 UTC

[46/50] fabric commit: updated refs/heads/2971-count-distinct to 5d18415

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


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/commit/cf220b2e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/cf220b2e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/cf220b2e

Branch: refs/heads/2971-count-distinct
Commit: cf220b2e927093e3bd6f409b4ca9f7b1be0a04a3
Parents: dd02a39
Author: Tony Sun <to...@cloudant.com>
Authored: Tue Jan 31 20:47:13 2017 -0800
Committer: Tony Sun <to...@cloudant.com>
Committed: Thu Feb 9 11:27:47 2017 -0800

----------------------------------------------------------------------
 src/fabric_view.erl | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/cf220b2e/src/fabric_view.erl
----------------------------------------------------------------------
diff --git a/src/fabric_view.erl b/src/fabric_view.erl
index 01291a9..45262e4 100644
--- a/src/fabric_view.erl
+++ b/src/fabric_view.erl
@@ -172,7 +172,9 @@ 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),
@@ -180,7 +182,9 @@ possibly_embed_doc(#collector{db_name=DbName, query_args=Args},
                     {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} ->