incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Anderson <jch...@apache.org>
Subject Re: validate_doc_update result format
Date Tue, 02 Feb 2010 17:39:29 GMT
On Tue, Feb 2, 2010 at 7:23 AM, Zachary Zolton <zachary.zolton@gmail.com> wrote:
> Cliff,
>
> Perhaps the wiki is out of date? The follow seemed to work for me:

Thanks for the notice -- I've fixed the wiki

>
>  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 error.
>
> 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 <cliff@may.be> wrote:
>> According to http://wiki.apache.org/couchdb/Security_Features_Overview the
>> the following validation function:
>>
>> validate_doc_update: "function(newDoc, oldDoc, userCtx) {
>>    throw {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
must
>> have an address.\">>}]}"}
>>
>> This looks like a bug to me.  Is there a better place to post this kind of
>> report?
>>
>> Regards,
>> Cliff.
>>
>> --
>> Cliff Stanford
>> Might Limited                           +44 845 0045 666 (Office)
>> Suite 67, Dorset House                  +44 7973 616 666 (Mobile)
>> Duke Street, Chelmsford, CM1 1TB
>>
>>
>



-- 
Chris Anderson
http://jchrisa.net
http://couch.io

Mime
View raw message