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:40:16 UTC

couch-mrview commit: updated refs/heads/windsor-merge to 911e5e9

Repository: couchdb-couch-mrview
Updated Branches:
  refs/heads/windsor-merge 258abc4a1 -> 911e5e955 (forced update)


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/911e5e95
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/911e5e95
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/911e5e95

Branch: refs/heads/windsor-merge
Commit: 911e5e955516d9a7b705cfde3a73b1ba786341b0
Parents: 60eb161
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:39:56 2014 +0100

----------------------------------------------------------------------
 src/couch_mrview.erl | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/911e5e95/src/couch_mrview.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview.erl b/src/couch_mrview.erl
index d5faca3..047bc00 100644
--- a/src/couch_mrview.erl
+++ b/src/couch_mrview.erl
@@ -42,6 +42,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;