[ 
https://issues.apache.org/jira/browse/COUCHDB-1318?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13139319#comment-13139319
 ] 

Jason Smith commented on COUCHDB-1318:
--------------------------------------

You request _design/ddoc/_view/foo

That means you want map function output. But No such map function was defined.

Bob Newson suggested 404, since there is no views.foo.map object.

function_clause is an Erlang error, not very informative to Couch users. For 
the response body, maybe something like this:

{"error":"not_found", "reason":"View definition must be an object with 'map' 
and 'reduce' values"}
                
> 500 function_clause error when requesting bad views
> ---------------------------------------------------
>
>                 Key: COUCHDB-1318
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1318
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Database Core
>    Affects Versions: 1.1
>         Environment: OS X, Linux
>            Reporter: Jason Smith
>            Priority: Minor
>
> Run the replicator test suite. The design document 
> /test_suite_rep_doc_db_a/_design/foobar is well-named. Its views definition 
> is not a {"map":..., "reduce":...} object but rather a string (of what would 
> be a map function).
> Design documents of this form return HTTP 500 with function_clause errors 
> when querying both (1) _view/the_bad_view and also (2) _info.
> Stack trace:
> [debug] [<0.20047.0>] 'GET' /asdf/_design/x/_view/jason {1,1} from "127.0.0.1"
> Headers: [{'Accept',"*/*"},
>           {'Host',"localhost:5984"},
>           {'User-Agent',"curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 
> OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15"}]
> [debug] [<0.20047.0>] OAuth Params: []
> [error] [<0.20047.0>] function_clause error in HTTP request
> [info] [<0.20047.0>] Stacktrace: [{couch_view_group,
>                                    '-design_doc_to_view_group/1-fun-0-',
>                                    [{<<"jason">>,
>                                      <<"function(doc) { emit(doc._id, 1) 
> }">>},
>                                     {dict,0,16,16,8,80,48,
>                                      {[],[],[],[],[],[],[],[],[],[],[],[],[],
>                                       [],[],[]},
>                                      {{[],[],[],[],[],[],[],[],[],[],[],[],[],
>                                        [],[],[]}}}]},
>                                   {lists,foldl,3},
>                                   {couch_view_group,design_doc_to_view_group,
>                                    1},
>                                   {couch_view_group,open_db_group,2},
>                                   {couch_view,get_group_server,2},
>                                   {couch_view,get_group,3},
>                                   {couch_view,get_map_view,4},
>                                   {couch_httpd_view,design_doc_view,5}]
> [info] [<0.20047.0>] 127.0.0.1 - - 'GET' /asdf/_design/x/_view/jason 500
> [debug] [<0.20047.0>] httpd 500 error response:
>  {"error":"unknown_error","reason":"function_clause"}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to