Send better error if user specifies key and keys closes COUCHDB-2053
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/2bc07840 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/2bc07840 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/2bc07840 Branch: refs/heads/2041-update-ibrowse Commit: 2bc0784030847cbbdd8998d3f135f91992768f6a Parents: e7fdc16 Author: Robert Newson <[email protected]> Authored: Fri Feb 7 11:00:24 2014 +0000 Committer: Robert Newson <[email protected]> Committed: Fri Feb 7 14:40:40 2014 +0000 ---------------------------------------------------------------------- src/couch_mrview/src/couch_mrview_util.erl | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/2bc07840/src/couch_mrview/src/couch_mrview_util.erl ---------------------------------------------------------------------- diff --git a/src/couch_mrview/src/couch_mrview_util.erl b/src/couch_mrview/src/couch_mrview_util.erl index c4272f8..95f7be4 100644 --- a/src/couch_mrview/src/couch_mrview_util.erl +++ b/src/couch_mrview/src/couch_mrview_util.erl @@ -359,11 +359,13 @@ validate_args(Args) -> _ -> mrverror(<<"`keys` must be an array of strings.">>) end, - case {Args#mrargs.keys, Args#mrargs.start_key} of - {undefined, _} -> ok; - {[], _} -> ok; - {[_|_], undefined} -> ok; - _ -> mrverror(<<"`start_key` is incompatible with `keys`">>) + case {Args#mrargs.keys, Args#mrargs.start_key, + Args#mrargs.end_key} of + {undefined, _, _} -> ok; + {[], _, _} -> ok; + {[_|_], undefined, undefined} -> ok; + _ -> mrverror(<<"`keys` is incompatible with `key`" + ", `start_key` and `end_key`">>) end, case Args#mrargs.start_key_docid of @@ -372,13 +374,6 @@ validate_args(Args) -> _ -> mrverror(<<"`start_key_docid` must be a string.">>) end, - case {Args#mrargs.keys, Args#mrargs.end_key} of - {undefined, _} -> ok; - {[], _} -> ok; - {[_|_], undefined} -> ok; - _ -> mrverror(<<"`end_key` is incompatible with `keys`">>) - end, - case Args#mrargs.end_key_docid of undefined -> ok; EKDocId0 when is_binary(EKDocId0) -> ok;
