[
https://issues.apache.org/jira/browse/COUCHDB-1659?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13565871#comment-13565871
]
Robert Newson commented on COUCHDB-1659:
----------------------------------------
I can't help but notice you refer to a variable 'doc' in your validation
function that doesn't exist.
> 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