Github user kxepal commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch/pull/177#discussion_r77217313
  
    --- Diff: src/couch_changes.erl ---
    @@ -377,6 +379,21 @@ check_selector(_Selector) ->
         throw({bad_request, "Selector error: expected a JSON object"}).
     
     
    +check_fields(nil) ->
    +    nil;
    +check_fields(Fields) when is_list(Fields) ->
    +    try
    +        {ok, Fields1} = mango_fields:new(Fields),
    +        Fields1
    +    catch
    +        {mango_error, Mod, Reason0} ->
    +            {_StatusCode, _Error, Reason} = mango_error:info(Mod, Reason0),
    +            throw({bad_request, Reason})
    +    end;
    +check_fields(_Fields) ->
    +    throw({bad_request, "Selector error: fields must be JSON array"}).
    --- End diff --
    
    Doesn't mango has own validators for that kind of errors?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to