summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Newson <rnewson@apache.org>2017-06-15 15:45:47 +0100
committerRobert Newson <rnewson@apache.org>2017-06-15 15:45:47 +0100
commit58b46ba3d19dc9293d048ab7524a914d8d144a12 (patch)
tree97b14cd63c0b5aa6760f46266648e1ca65ae4b61
parent73f6b18f7bd83ef21e05436a6497b7cd207156f3 (diff)
downloadcouchdb-pass-view-error.tar.gz
Pass error through (usually timeout)pass-view-error
-rw-r--r--src/mango/src/mango_cursor_view.erl11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/mango/src/mango_cursor_view.erl b/src/mango/src/mango_cursor_view.erl
index ffa5ec168..e97311c72 100644
--- a/src/mango/src/mango_cursor_view.erl
+++ b/src/mango/src/mango_cursor_view.erl
@@ -86,7 +86,7 @@ execute(#cursor{db = Db, index = Idx} = Cursor0, UserFun, UserAcc) ->
include_docs = true
},
Args = apply_opts(Cursor#cursor.opts, BaseArgs),
- {ok, LastCursor} = case mango_idx:def(Idx) of
+ Result = case mango_idx:def(Idx) of
all_docs ->
CB = fun ?MODULE:handle_all_docs_message/2,
fabric:all_docs(Db, CB, Cursor, Args);
@@ -97,7 +97,12 @@ execute(#cursor{db = Db, index = Idx} = Cursor0, UserFun, UserAcc) ->
Name = mango_idx:name(Idx),
fabric:query_view(Db, DDoc, Name, CB, Cursor, Args)
end,
- {ok, LastCursor#cursor.user_acc}
+ case Result of
+ {ok, LastCursor} ->
+ {ok, LastCursor#cursor.user_acc};
+ {error, Reason} ->
+ {error, Reason}
+ end
end.
@@ -285,4 +290,4 @@ is_design_doc(RowProps) ->
case couch_util:get_value(id, RowProps) of
<<"_design/", _/binary>> -> true;
_ -> false
- end. \ No newline at end of file
+ end.