You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2014/08/28 14:21:11 UTC

[36/50] fabric commit: updated refs/heads/master to a71701c

Fix logging of errors in _all_docs open_doc calls

Our exception handling accidentally captured the successful return
value. Using try/of/catch we can exit from the of clause without
catching.

BugzId: 26162


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

Branch: refs/heads/master
Commit: a01d2395fd6970c7802b668898aa7eb1c3ea73a4
Parents: 1fced48
Author: Paul J. Davis <pa...@gmail.com>
Authored: Fri Dec 13 13:56:44 2013 -0600
Committer: Robert Newson <rn...@apache.org>
Committed: Fri Aug 1 15:33:43 2014 +0100

----------------------------------------------------------------------
 src/fabric_view_all_docs.erl | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/a01d2395/src/fabric_view_all_docs.erl
----------------------------------------------------------------------
diff --git a/src/fabric_view_all_docs.erl b/src/fabric_view_all_docs.erl
index 4403146..d4dec09 100644
--- a/src/fabric_view_all_docs.erl
+++ b/src/fabric_view_all_docs.erl
@@ -206,8 +206,9 @@ doc_receive_loop(Keys, Pids, SpawnFun, MaxJobs, Callback, AccIn) ->
 
 
 open_doc(DbName, Options, Id, IncludeDocs) ->
-    try
-        open_doc_int(DbName, Options, Id, IncludeDocs)
+    try open_doc_int(DbName, Options, Id, IncludeDocs) of
+        #view_row{} = Row ->
+            exit(Row)
     catch Type:Reason ->
         Stack = erlang:get_stacktrace(),
         couch_log:error("_all_docs open error: ~s ~s :: ~w ~w", [
@@ -231,7 +232,7 @@ open_doc_int(DbName, Options, Id, IncludeDocs) ->
         Value = {[{rev,couch_doc:rev_to_str({RevPos, RevId})}]},
         #view_row{key=Id, id=Id, value=Value}
     end,
-    exit(if IncludeDocs -> Row#view_row{doc=Doc}; true -> Row end).
+    if IncludeDocs -> Row#view_row{doc=Doc}; true -> Row end.
 
 cancel_read_pids(Pids) ->
     case queue:out(Pids) of