Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MB-6895 Fix badmatch on error

For old couchdb views, used for development subset, expect
error results to be inlined with non-error results.

Change-Id: I5cd33ee7caeeec4bd65b548431788b2f3967fb35
Reviewed-on: http://review.couchbase.org/24474
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
  • Loading branch information...
commit da000c225be6ad4821bda8212c27190ecdbe3284 1 parent dc873dd
@fdmanana fdmanana authored fdmanana committed
Showing with 6 additions and 4 deletions.
  1. +6 −4 src/couchdb/couch_view_mapreduce.erl
View
10 src/couchdb/couch_view_mapreduce.erl
@@ -64,10 +64,12 @@ map(Doc) ->
{DocBody, DocMeta} = couch_doc:to_raw_json_binary_views(Doc),
case mapreduce:map_doc(Ctx, DocBody, DocMeta) of
{ok, Results} ->
- {ok, [
- [{?JSON_DECODE(K), ?JSON_DECODE(V)} || {K, V} <- FunResult]
- || FunResult <- Results
- ]};
+ Fun = fun({error, _Reason} = Error) ->
+ Error;
+ ({K, V}) ->
+ {?JSON_DECODE(K), ?JSON_DECODE(V)}
+ end,
+ {ok, [lists:map(Fun, FunResult) || FunResult <- Results]};
Error ->
throw(Error)
end.
Please sign in to comment.
Something went wrong with that request. Please try again.