You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Anthony Ananich (JIRA)" <ji...@apache.org> on 2013/01/29 23:33:12 UTC

[jira] [Resolved] (COUCHDB-1659) Empty error message when validation function conflicts with Update Handler

     [ https://issues.apache.org/jira/browse/COUCHDB-1659?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anthony Ananich resolved COUCHDB-1659.
--------------------------------------

    Resolution: Invalid

Thanks a lot, Robert! That is the root of the problem. When I change doc -> newDoc everything works as expected.
                
> Empty error message when validation function conflicts with Update Handler
> --------------------------------------------------------------------------
>
>                 Key: COUCHDB-1659
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1659
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Database Core, JavaScript View Server
>            Reporter: Anthony Ananich
>         Attachments: app.txt, log.txt
>
>
> I have a design doc (attached to this isssue) with update handler and validation function. When I submit HTML form to the update handler, I've got the following error:
> {
>     error: "case_clause",
>     reason: "{[]}"
> }
> The issue is that this error has no information about what the actual reason is.
> Update Handler:
> function(doc, req) {
>     if (parseInt(req.form.key)>10) {
>         return [null, "not updated"];;
>     } else {
>         if (doc==null) {
>             doc = req.form;
>         } else {
>             doc.val = req.query.val;
>         }
>         return [doc, "updated"];
>     }
> }
> Validate Function:
> function(newDoc, oldDoc, userCtx, secObj) {
>     if (parseInt(doc.key)>5) {
>         throw ({forbidden: "key is too big"});
>     }
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira