jcoglan commented on code in PR #5858:
URL: https://github.com/apache/couchdb/pull/5858#discussion_r3615062309
##########
src/mango/src/mango_native_proc.erl:
##########
@@ -95,6 +100,17 @@ handle_call({prompt, [<<"nouveau_index_doc">>, Doc]},
_From, St) ->
Else
end,
{reply, Vals, St};
+handle_call({prompt, [<<"validate_fun">>, Selector0 | _Rest]}, _From, St) ->
+ try mango_selector:normalize(Selector0) of
+ Selector ->
+ case validate_vdu(Selector) of
+ ok -> {reply, true, St};
+ Error -> {reply, {error, Error}, St}
+ end
+ catch
+ throw:{mango_error, mango_selector, Error} ->
Review Comment:
I've ended up putting more specific clauses here to catch invalid field and
operator errors, which come from different places. I'm open to suggestions on
style though; I wasn't sure of the best way to catch these and turn them into
400s rather than 500s. Will push along with everything else I'm fixing.
--
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]