Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 92617 invoked from network); 2 Feb 2010 15:24:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 2 Feb 2010 15:24:17 -0000 Received: (qmail 83153 invoked by uid 500); 2 Feb 2010 15:24:15 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 83077 invoked by uid 500); 2 Feb 2010 15:24:15 -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 83067 invoked by uid 99); 2 Feb 2010 15:24:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Feb 2010 15:24:15 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of zachary.zolton@gmail.com designates 209.85.219.213 as permitted sender) Received: from [209.85.219.213] (HELO mail-ew0-f213.google.com) (209.85.219.213) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Feb 2010 15:24:05 +0000 Received: by ewy5 with SMTP id 5so176995ewy.32 for ; Tue, 02 Feb 2010 07:23:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=EZmXSNQ2Q6ow9t3K/0cvCBIIb0JE+d73yjc3mLrAFvs=; b=w+0KfPik4N625af7Szszgqf9nV0qOoh2YvyT2GFp5xVTkzKIefnJL/ZwDr/cMuafgu Z+qGU800VgBxUguLIJQG9ThmkV4udxHvnDEIL8z99LRbj6jlC1CxblOELMFbJI2kYMQY Uo6mx1ywCQKI9r8uKGFdwGpU5zHzhtP7R18jU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=M3X4S6tQaLKQt9cWV/xCsL/sDVfRpb6wg0D8xZ3O2df6RBXu9GLJImM6iAHhk5Coam e3G0HZtvarOH7IMjG1c4wrB4eAu9ay/HmNF5q4wIk8Q2qS6FonGY8w05WXR9FyO7jBMw WRtBHgEvF/HOQZXJa1PW4rtfpu4w3NiGU9OvM= MIME-Version: 1.0 Received: by 10.216.88.140 with SMTP id a12mr3208496wef.157.1265124224227; Tue, 02 Feb 2010 07:23:44 -0800 (PST) In-Reply-To: <4B680F11.1080904@may.be> References: <4B680F11.1080904@may.be> From: Zachary Zolton Date: Tue, 2 Feb 2010 09:23:24 -0600 Message-ID: Subject: Re: validate_doc_update result format To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Cliff, Perhaps the wiki is out of date? The follow seemed to work for me: throw({unauthorized : message}); // for invalid data OR throw({forbidden : message}); // for unauthorized updates Whereas adding any other attribute to the throw object resulted in a 500 er= ror. The CouchDB book looks up-to-date on the matter: http://books.couchdb.org/relax/design-documents/validation-functions Cheers, Zach On Tue, Feb 2, 2010 at 5:40 AM, Cliff Stanford wrote: > According to http://wiki.apache.org/couchdb/Security_Features_Overview th= e > the following validation function: > > validate_doc_update: "function(newDoc, oldDoc, userCtx) { > =A0 =A0throw {missing_field: 'Document must have an address.'}; > }" > > should give the result: > > HTTP/1.1 401 Unauthorized > ... > {"error":"missing_field","reason":"Document must have an address."} > > Using the released CouchDB 0.10.0 I get the following result: > > HTTP/1.1 500 Internal Server Error > ... > {"error":"try_clause","reason":"{[{<<\"missing_field\">>,<<\"Document mus= t > have an address.\">>}]}"} > > This looks like a bug to me. =A0Is there a better place to post this kind= of > report? > > Regards, > Cliff. > > -- > Cliff Stanford > Might Limited =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 +44 845= 0045 666 (Office) > Suite 67, Dorset House =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0+44 7973 616 66= 6 (Mobile) > Duke Street, Chelmsford, CM1 1TB > >