Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 11715 invoked from network); 12 Dec 2009 17:53:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 12 Dec 2009 17:53:06 -0000 Received: (qmail 93844 invoked by uid 500); 12 Dec 2009 17:53:05 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 93757 invoked by uid 500); 12 Dec 2009 17:53:04 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 93746 invoked by uid 99); 12 Dec 2009 17:53:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 12 Dec 2009 17:53:04 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [83.97.50.139] (HELO jan.prima.de) (83.97.50.139) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 12 Dec 2009 17:52:55 +0000 Received: from [192.168.1.115] (c-98-248-172-14.hsd1.ca.comcast.net [::ffff:98.248.172.14]) (AUTH: LOGIN jan, TLS: TLSv1/SSLv3,128bits,AES128-SHA) by jan.prima.de with esmtp; Sat, 12 Dec 2009 17:52:33 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1077) Subject: Re: _show without docid returns 500 instead of 404 From: Jan Lehnardt In-Reply-To: <1259687083.7371.82.camel@zelda.buyways.nl> Date: Sat, 12 Dec 2009 09:51:58 -0800 Content-Transfer-Encoding: 7bit Message-Id: <441370D1-1DF4-40A1-94C7-96A7D0FF3684@apache.org> References: <1259663713.7371.37.camel@zelda.buyways.nl> <4B15007C.3020801@gmail.com> <1259668260.7371.43.camel@zelda.buyways.nl> <1259687083.7371.82.camel@zelda.buyways.nl> To: user@couchdb.apache.org X-Mailer: Apple Mail (2.1077) X-Virus-Checked: Checked by ClamAV on apache.org Hi, great thread. Can you open a JIRA ticket so we don't lose track of this? https://issues.apache.org/jira/browse/COUCHDB Cheers Jan -- On 1 Dec 2009, at 09:04, Markus Jelsma - Buyways B.V. wrote: > Hello Chris, > > > I'm glad you agree on my assumption that either the book or code is > wrong and i'm glad something can be done about it. > > Creating a custom 404 respone inside the show function seems > inappropriate to me. Since show functions are without side-effects they > cannot rely on other components in rendering a proper response so > rendering a custom reusable error response is out of the question. And > besides, a 404 Not Found is - in my opinion - exactly what we need and > allows/forces for the caller to handle it properly. > > In short, i concur. I would vote for the 404 reply and thus follow the > instructions in the book. > > > Regards, > M. > > > > On Tue, 2009-12-01 at 08:44 -0800, Chris Anderson wrote: > > >> I think in this case the book is wrong (or maybe it is right and the >> code is wrong). In the case of a missing doc the code currently forces >> you to raise the 404 error from your show function. >> >> I think this was done so that you have the option to render your own >> 404 error message, instead of being stuck with CouchDB's JSON message. >> >> The arguments for the CouchDB handling 404 for you: >> >> It's simpler to program because CouchDB handles some major error >> handling for you (and properly) >> It's more efficient b/c your JS function is not called in the case of >> a missing docid. >> >> The arguments for the current system (handle your own errors) pretty >> much boil down to some increased flexibility. The flexibility of 404 >> messages might be better handled outside of show functions anyway. >> >> I am leaning toward the description the book gives (which would mean a >> code change). If you convince me it should be changed, I'll change it. >> Is anyone relying on the ability of show functions to render their own >> 404s? >> >> The change would be simple, just remove a catch clause on >> couch_httpd_show.erl line 81. >> >> Chris >>