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/06 12:38:53 UTC
[2/2] couch-mrview commit: updated refs/heads/windsor-merge to 258abc4
Gracefully handle design document updates with malformatted structure
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/commit/258abc4a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/258abc4a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/258abc4a
Branch: refs/heads/windsor-merge
Commit: 258abc4a13e8e3fb586d71c0843d6f5ed6a0ecf4
Parents: 5942d53
Author: Robert Newson <rn...@apache.org>
Authored: Wed Aug 6 11:34:25 2014 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Wed Aug 6 11:34:25 2014 +0100
----------------------------------------------------------------------
src/couch_mrview.erl | 9 +++++++++
1 file changed, 9 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/258abc4a/src/couch_mrview.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview.erl b/src/couch_mrview.erl
index 4c2de5f..22e9fbd 100644
--- a/src/couch_mrview.erl
+++ b/src/couch_mrview.erl
@@ -43,6 +43,15 @@
validate(DbName, DDoc) ->
+ {Fields} = DDoc#doc.body,
+ case couch_util:get_value(<<"options">>, Fields, {[]}) of
+ {_} -> ok;
+ _ -> throw({invalid_design_doc, <<"`options` parameter must be an object.">>})
+ end,
+ case couch_util:get_value(<<"views">>, Fields, {[]}) of
+ {_} -> ok;
+ _ -> throw({invalid_design_doc, <<"`views` parameter must be an object.">>})
+ end,
GetName = fun
(#mrview{map_names = [Name | _]}) -> Name;
(#mrview{reduce_funs = [{Name, _} | _]}) -> Name;