Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 63009 invoked from network); 13 Dec 2009 22:45:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Dec 2009 22:45:52 -0000 Received: (qmail 2513 invoked by uid 500); 13 Dec 2009 22:45:51 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 2388 invoked by uid 500); 13 Dec 2009 22:45:50 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 2378 invoked by uid 99); 13 Dec 2009 22:45:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 13 Dec 2009 22:45:50 +0000 X-ASF-Spam-Status: No, hits=-1998.5 required=10.0 tests=ALL_TRUSTED,WEIRD_PORT X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 13 Dec 2009 22:45:39 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 19518234C045 for ; Sun, 13 Dec 2009 14:45:18 -0800 (PST) Message-ID: <686581823.1260744318088.JavaMail.jira@brutus> Date: Sun, 13 Dec 2009 22:45:18 +0000 (UTC) From: "Markus (JIRA)" To: dev@couchdb.apache.org Subject: [jira] Created: (COUCHDB-598) _show without docid returns 500 instead of 404 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org _show without docid returns 500 instead of 404 ---------------------------------------------- Key: COUCHDB-598 URL: https://issues.apache.org/jira/browse/COUCHDB-598 Project: CouchDB Issue Type: Bug Components: HTTP Interface Affects Versions: 0.10 Environment: Ubuntu Karmic Reporter: Markus Priority: Minor See also the thread on the mailing list::http://www.mail-archive.com/user@couchdb.apache.org/msg05633.html and especially the following quote from Chris Anderson :" The change would be simple, just remove a catch clause on couch_httpd_show.erl line 81." Original message below: ------ According to http://books.couchdb.org/relax/design-documents/shows#Querying%20Show% 20Functions i should receive an HTTP 404 Not Found response, instead i get a HTTP 500 Internal Server Error. I am unsure as of yet whether i am doing something wrong or if i should file a bug report for this one. Here are my two documents in my test database named shows: { "_id": "_design/test", "_rev": "1-21a6d69070ae4bec3e9f14fbb7f93201", "shows": { "summary": "function (doc, req) { return '

'+doc.title+'

'+doc.body+'

'; } " } } and { "_id": "bd108c433aedaa1bd2def0ec85e59a0d", "_rev": "3-5a031adf97aabe4888b9bfb94ba28d13", "title": "title", "body": "body text" } I receive proper results using the following HTTP GET request http://zealand:5984/shows/_design/test/_show/summary/bd108c433aedaa1bd2def0ec85e59a0d - code : 200 - body :

title

body text

Now consider querying the same show function with a non-existing document id http://zealand:5984/shows/_design/test/_show/summary/404 - code 500 - body {"error":"normal","reason":"{gen_server,call,\n [couch_query_servers,\n {ret_proc,{proc,<0.1481.0>,<< \"javascript\">>,\n {couch_os_process,prompt},\n {couch_os_process,set_timeout},\n {couch_os_process,stop}}}]}"} Here is the output in the couch.log file: [Tue, 01 Dec 2009 10:31:37 GMT] [debug] [<0.1594.0>] OAuth Params: [] [Tue, 01 Dec 2009 10:31:37 GMT] [info] [<0.1726.0>] OS Process :: function raised error: TypeError: doc is null [Tue, 01 Dec 2009 10:31:37 GMT] [info] [<0.1726.0>] OS Process :: stacktrace: (null,[object Object])@:0 runShow(function (doc, req) {return "

" + doc.title + "

" + doc.body + "

";},null,[object Object],"function (doc, req) { return '

'+doc.title+'

'+doc.body+'

'; } ")@/usr/share/couchdb/server/main.js:388 ("function (doc, req) { return '

'+doc.title+'

'+doc.body +'

'; } ",null,[object Object])@/usr/share/couchdb/server/main.js:358 @/usr/share/couchdb/server/main.js:842 [Tue, 01 Dec 2009 10:31:37 GMT] [error] [<0.1594.0>] OS Process Error :: {render_error,{[{<<"body">>, <<"

Render Error

JavaScript function raised error: TypeError: doc is null

Stacktrace:

(null,[object Object])@:0
\nrunShow(function (doc, req) {return \"<h1>\" + doc.title +
\"</h1><p>\" + doc.body + \"</p>\";},null,[object
Object],\"function (doc, req) { return '<h1>'+doc.title
+'</h1><p>'+doc.body+'</p>'; }
\")@/usr/share/couchdb/server/main.js:388\n(\"function (doc, req)
{ return '<h1>'+doc.title+'</h1><p>'+doc.body
+'</p>'; } \",null,[object
Object])@/usr/share/couchdb/server/main.js:358
\n@/usr/share/couchdb/server/main.js:842\n

Function source:

function (doc, req) { return
'<h1>'+doc.title+'</h1><p>'+doc.body+'</p>'; }
">>}]}} [Tue, 01 Dec 2009 10:31:37 GMT] [debug] [<0.1628.0>] Unknown linked process died: <0.1726.0> (reason: normal) [Tue, 01 Dec 2009 10:31:37 GMT] [error] [<0.53.0>] {error_report,<0.24.0>, {<0.53.0>,supervisor_report, [{supervisor,{local,couch_secondary_services}}, {errorContext,child_terminated}, {reason,normal}, {offender,[{pid,<0.1628.0>}, {name,query_servers}, {mfa,{couch_query_servers,start_link,[]}}, {restart_type,permanent}, {shutdown,brutal_kill}, {child_type,worker}]}]}} [Tue, 01 Dec 2009 10:31:37 GMT] [error] [<0.1594.0>] Uncaught error in HTTP request: {exit, {normal, {gen_server,call, [couch_query_servers, {ret_proc, {proc,<0.1726.0>,<<"javascript">>, {couch_os_process,prompt}, {couch_os_process,set_timeout}, {couch_os_process,stop}}}]}}} [Tue, 01 Dec 2009 10:31:37 GMT] [info] [<0.1594.0>] Stacktrace: [{gen_server,call,2}, {couch_query_servers,ret_os_process,1}, {couch_query_servers,render_doc_show,6}, {couch_httpd_show,'-send_doc_show_response/6-fun-0-',6}, {couch_httpd_db,do_db_req,2}, {couch_httpd,handle_request,5}, {mochiweb_http,headers,5}, {proc_lib,init_p_do_apply,3}] [Tue, 01 Dec 2009 10:31:37 GMT] [debug] [<0.1594.0>] httpd 500 error response: {"error":"normal","reason":"{gen_server,call,\n [couch_query_servers,\n {ret_proc,{proc,<0.1726.0>,<< \"javascript\">>,\n {couch_os_process,prompt},\n {couch_os_process,set_timeout},\n {couch_os_process,stop}}}]}"} [Tue, 01 Dec 2009 10:31:37 GMT] [info] [<0.1594.0>] 192.168.218.87 - - 'GET' /shows/_design/test/_show/summary/404 50 I am using CouchDB 0.10.0 from Ubuntu Karmic's repository. Any assistance is much appreciated. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.