couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [49/49] fabric commit: updated refs/heads/windsor-merge to b1c0030
Date Fri, 01 Aug 2014 14:35:10 GMT
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/windsor-merge
Commit: a01d2395fd6970c7802b668898aa7eb1c3ea73a4
Parents: 1fced48
Author: Paul J. Davis <paul.joseph.davis@gmail.com>
Authored: Fri Dec 13 13:56:44 2013 -0600
Committer: Robert Newson <rnewson@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


Mime
View raw message