You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ji...@apache.org on 2018/06/27 11:52:34 UTC

[couchdb] branch COUCHDB-3326-clustered-purge-pr5-implementation updated: Modify return message for _purge

This is an automated email from the ASF dual-hosted git repository.

jiangphcn pushed a commit to branch COUCHDB-3326-clustered-purge-pr5-implementation
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/COUCHDB-3326-clustered-purge-pr5-implementation by this push:
     new bf46728  Modify return message for _purge
bf46728 is described below

commit bf46728f2cf95272d4cb4bbb4edfd304ec332a51
Author: jiangphcn <ji...@cn.ibm.com>
AuthorDate: Wed Jun 27 19:51:48 2018 +0800

    Modify return message for _purge
    
    COUCHDB-3326
---
 src/chttpd/src/chttpd_db.erl           | 4 ++--
 src/chttpd/test/chttpd_purge_tests.erl | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/chttpd/src/chttpd_db.erl b/src/chttpd/src/chttpd_db.erl
index cbdb641..8bd4b7b 100644
--- a/src/chttpd/src/chttpd_db.erl
+++ b/src/chttpd/src/chttpd_db.erl
@@ -504,7 +504,7 @@ db_req(#httpd{method='POST',path_parts=[_,<<"_purge">>]}=Req, Db) ->
     IdsRevs2 = [{Id, couch_doc:parse_revs(Revs)} || {Id, Revs} <- IdsRevs],
     MaxIds = config:get_integer("purge", "max_document_id_number", 100),
     case length(IdsRevs2) =< MaxIds of
-        false -> throw({bad_request, "Document numbers larger than expected"});
+        false -> throw({bad_request, "Exceeded maximum number of documents."});
         true -> ok
     end,
     RevsLen = lists:foldl(fun({_Id, Revs}, Acc) ->
@@ -512,7 +512,7 @@ db_req(#httpd{method='POST',path_parts=[_,<<"_purge">>]}=Req, Db) ->
     end, 0, IdsRevs2),
     MaxRevs = config:get_integer("purge", "max_revisions_number", 1000),
     case RevsLen =< MaxRevs of
-        false -> throw({bad_request, "Document revs larger than expected"});
+        false -> throw({bad_request, "Exceeded maximum number of revisions."});
         true -> ok
     end,
     {ok, Results} = fabric:purge_docs(Db, IdsRevs2, Options),
diff --git a/src/chttpd/test/chttpd_purge_tests.erl b/src/chttpd/test/chttpd_purge_tests.erl
index 2b06b2a..6865525 100644
--- a/src/chttpd/test/chttpd_purge_tests.erl
+++ b/src/chttpd/test/chttpd_purge_tests.erl
@@ -252,7 +252,7 @@ test_overmany_ids_or_revs_purge_request(Url) ->
         ?assertEqual(400, Status),
         ?assertMatch({[
             {<<"error">>,<<"bad_request">>},
-            {<<"reason">>,<<"Document numbers larger than expected">>}]},
+            {<<"reason">>,<<"Exceeded maximum number of documents.">>}]},
             ResultJson),
 
         % Revs larger than expected
@@ -264,7 +264,7 @@ test_overmany_ids_or_revs_purge_request(Url) ->
         ?assertEqual(400, Status2),
         ?assertMatch({[
             {<<"error">>,<<"bad_request">>},
-            {<<"reason">>,<<"Document revs larger than expected">>}]},
+            {<<"reason">>,<<"Exceeded maximum number of revisions.">>}]},
             ResultJson2)
     end).