You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2018/05/03 01:37:32 UTC

[GitHub] bgottlob opened a new pull request #1310: Clarify bad index creation error messages

bgottlob opened a new pull request #1310: Clarify bad index creation error messages
URL: https://github.com/apache/couchdb/pull/1310
 
 
   ## Overview
   
   Per issue #927, creating a mango index with a malformed `fields` value will output an error message printing back the JSON binary string of `fields` as ASCII codes for each character (i.e., `<<"foo">>` prints as `<<102,111,111>>`. This fix prints `fields` in a readable way (`<<"foo">>`)  
   
   ## Testing recommendations
   
   Hit your couch cluster with this request (reproducing #927):
   ```
   curl -v -X POST http://admin:abc123@localhost:6002/foo/_index -H 'Content-Type: application/json' -d '{"index":{"fields":"foo"}}'
   ```
   
   ## Testing Results
   
   I tested the change with multiple invalid input values for `fields`, with these results:
   ```
   Request body: {"index":{"fields":"foo"}}
   Response body: {"error":"invalid_sort_json","reason":"Sort must be an array of sort specs, not: <<\"foo\">>"}
   
   Request body: {"index":{"fields":{}}}
   Response body: {"error":"invalid_sort_json","reason":"Sort must be an array of sort specs, not: {[]}"}
   
   Request body: {"index":{"fields":{"blah":"foo"}}}                                 
   Response body: {"error":"invalid_sort_json","reason":"Sort must be an array of sort specs, not: {[{<<\"blah\">>,<<\"foo\">>}]}"}                                     
   
   Request body: {"index":{"fields":[{"blah":"foo"}]}}                               
   Response body: {"error":"invalid_sort_field","reason":"Invalid sort field: {[{<<\"blah\">>,<<\"foo\">>}]}"}
   
   Request body: {"index":{"fields":[{"blah":{"blah":"foo"}}]}}                      
   Response body: {"error":"invalid_sort_field","reason":"Invalid sort field: {[{<<\"blah\">>,{[{<<\"blah\">>,<<\"foo\">>}]}}]}"}
   ```
   
   ## Related Issues or Pull Requests
   
   Fixes #927 
   
   ## Checklist
   
   - [ ] Code is written and works correctly;
   - [ ] Changes are covered by tests;
   - [ ] Documentation reflects the changes;
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services