jaydoane commented on code in PR #4414:
URL: https://github.com/apache/couchdb/pull/4414#discussion_r1130554459


##########
src/couch_mrview/src/couch_mrview_http.erl:
##########
@@ -525,34 +530,147 @@ parse_param(Key, Val, Args, IsDecoded) ->
         "reduce" ->
             Args#mrargs{reduce = parse_boolean(Val)};
         "key" when IsDecoded ->
-            Args#mrargs{start_key = Val, end_key = Val};
+            case Args#mrargs.start_key =:= undefined andalso 
Args#mrargs.end_key =:= undefined of
+                true ->
+                    Args#mrargs{start_key = Val, end_key = Val};
+                _ ->
+                    throw(
+                        {query_parse_error,
+                            <<"`key(s)` is incompatible with `start_key` and 
`end_key`">>}
+                    )
+            end;

Review Comment:
   While logically correct, I find this kind of boilerplate can be hard to 
easily understand.
   
   I tried to refactor this file here: 
https://github.com/apache/couchdb/commit/f1777aac244f46d3e9cf6521f0bb6f1726f8e638
 to make it easier to understand. What do you think?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to