couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chewbra...@apache.org
Subject [01/22] couch-mrview commit: updated refs/heads/1963-eunit-bigcouch to cc9c436
Date Thu, 28 Aug 2014 17:27:23 GMT
Repository: couchdb-couch-mrview
Updated Branches:
  refs/heads/1963-eunit-bigcouch 395d7f310 -> cc9c4360f (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/1963-eunit-bigcouch
Commit: 911e5e955516d9a7b705cfde3a73b1ba786341b0
Parents: 60eb161
Author: Robert Newson <rnewson@apache.org>
Authored: Wed Aug 6 11:34:25 2014 +0100
Committer: Robert Newson <rnewson@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;


Mime
View raw message