You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Jason Davies (JIRA)" <ji...@apache.org> on 2009/07/11 18:06:14 UTC

[jira] Created: (COUCHDB-410) JavaScript errors in validate_doc_update should be handled more gracefully

JavaScript errors in validate_doc_update should be handled more gracefully
--------------------------------------------------------------------------

                 Key: COUCHDB-410
                 URL: https://issues.apache.org/jira/browse/COUCHDB-410
             Project: CouchDB
          Issue Type: Bug
          Components: Database Core
    Affects Versions: 0.9.1, 0.10
            Reporter: Jason Davies
             Fix For: 0.9.1


For example, if I create validate_doc_update:

function (oldDoc, newDoc, userCtx) {
  doc.myUndefinedProperty;
}

I am greeted by an "OS process timed out" message.  In the logs, all I see is:

OS Process :: Error converting object to JSON: TypeError: {Array:function (v) {var buf = [];for (var i = 0; i < v.length; i++) {buf.push(toJSON(v[i]));}return "[" + buf.join(",") + "]";}, Boolean:function (v) {return v.toString();}, Date:function (v) {var f = function (n) {return n < 10 ? "0" + n : n;};return "\"" + v.getUTCFullYear() + "-" + f(v.getUTCMonth() + 1) + "-" + f(v.getUTCDate()) + "T" + f(v.getUTCHours()) + ":" + f(v.getUTCMinutes()) + ":" + f(v.getUTCSeconds()) + "Z\"";}, Number:function (v) {return isFinite(v) ? v.toString() : "null";}, Object:function (v) {if (v === null) {return "null";}var buf = [];for (var k in v) {if (!v.hasOwnProperty(k) || typeof k !== "string" || v[k] === undefined) {continue;}buf.push(toJSON(k, val) + ": " + toJSON(v[k]));}return "{" + buf.join(",") + "}";}, String:function (v) {if (/["\\\x00-\x1f]/.test(v)) {v = v.replace(/([\x00-\x1f\\"])/g, function (a, b) {var c = subs[b];if (c) {return c;}c = b.charCodeAt();return "\\u00" + Math.floor(c / 16).toString(16) + (c % 16).toString(16);});}return "\"" + v + "\"";}}[val != null ? val.constructor.name : "Object"] is not a function

When really the problem is a ReferenceError.  The attached patch modifies toJSON() in utils.js so that it converts anything that isn't a String, Array, Date, Object etc. into a String.  This makes the error appear in the popup in Futon when saving.

This isn't necessarily the best thing to do as it modifies the semantics of toJSON(), and also we might want to keep the exception info in the logs, and not propagate it to the user.  Perhaps it would be better to modify respond(obj) to produce a better error message in the logs (simply adding something that tried to log obj.toString() would suffice).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COUCHDB-410) JavaScript errors in validate_doc_update should be handled more gracefully

Posted by "Noah Slater (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-410?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Noah Slater updated COUCHDB-410:
--------------------------------

    Fix Version/s:     (was: 0.11)
                   0.12

> JavaScript errors in validate_doc_update should be handled more gracefully
> --------------------------------------------------------------------------
>
>                 Key: COUCHDB-410
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-410
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Database Core
>    Affects Versions: 0.9.1, 0.10
>            Reporter: Jason Davies
>             Fix For: 0.12
>
>         Attachments: util.js.diff
>
>
> For example, if I create validate_doc_update:
> function (oldDoc, newDoc, userCtx) {
>   doc.foo;
> }
> I am greeted by an "OS process timed out" message.  In the logs, all I see is:
> OS Process :: Error converting object to JSON: TypeError: {Array:function (v) {var buf = [];for (var i = 0; i < v.length; i++) {buf.push(toJSON(v[i]));}return "[" + buf.join(",") + "]";}, Boolean:function (v) {return v.toString();}, Date:function (v) {var f = function (n) {return n < 10 ? "0" + n : n;};return "\"" + v.getUTCFullYear() + "-" + f(v.getUTCMonth() + 1) + "-" + f(v.getUTCDate()) + "T" + f(v.getUTCHours()) + ":" + f(v.getUTCMinutes()) + ":" + f(v.getUTCSeconds()) + "Z\"";}, Number:function (v) {return isFinite(v) ? v.toString() : "null";}, Object:function (v) {if (v === null) {return "null";}var buf = [];for (var k in v) {if (!v.hasOwnProperty(k) || typeof k !== "string" || v[k] === undefined) {continue;}buf.push(toJSON(k, val) + ": " + toJSON(v[k]));}return "{" + buf.join(",") + "}";}, String:function (v) {if (/["\\\x00-\x1f]/.test(v)) {v = v.replace(/([\x00-\x1f\\"])/g, function (a, b) {var c = subs[b];if (c) {return c;}c = b.charCodeAt();return "\\u00" + Math.floor(c / 16).toString(16) + (c % 16).toString(16);});}return "\"" + v + "\"";}}[val != null ? val.constructor.name : "Object"] is not a function
> When really the problem is a ReferenceError (I should have used newDoc.foo or oldDoc.foo).  The attached patch modifies toJSON() in utils.js so that it converts anything that isn't a String, Array, Date, Object etc. into a String.  This makes the error appear in the popup in Futon when saving.
> This isn't necessarily the best thing to do as it modifies the semantics of toJSON(), and also we might want to keep the exception info in the logs, and not propagate it to the user.  Perhaps it would be better to modify respond(obj) to produce a better error message in the logs (simply adding something that tried to log obj.toString() would suffice).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COUCHDB-410) JavaScript errors in validate_doc_update should be handled more gracefully

Posted by "Paul Joseph Davis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-410?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Joseph Davis updated COUCHDB-410:
--------------------------------------

    Skill Level: New Contributors Level (Easy)

> JavaScript errors in validate_doc_update should be handled more gracefully
> --------------------------------------------------------------------------
>
>                 Key: COUCHDB-410
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-410
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Database Core
>    Affects Versions: 0.9.1, 0.10
>            Reporter: Jason Davies
>             Fix For: 0.12
>
>         Attachments: util.js.diff
>
>
> For example, if I create validate_doc_update:
> function (oldDoc, newDoc, userCtx) {
>   doc.foo;
> }
> I am greeted by an "OS process timed out" message.  In the logs, all I see is:
> OS Process :: Error converting object to JSON: TypeError: {Array:function (v) {var buf = [];for (var i = 0; i < v.length; i++) {buf.push(toJSON(v[i]));}return "[" + buf.join(",") + "]";}, Boolean:function (v) {return v.toString();}, Date:function (v) {var f = function (n) {return n < 10 ? "0" + n : n;};return "\"" + v.getUTCFullYear() + "-" + f(v.getUTCMonth() + 1) + "-" + f(v.getUTCDate()) + "T" + f(v.getUTCHours()) + ":" + f(v.getUTCMinutes()) + ":" + f(v.getUTCSeconds()) + "Z\"";}, Number:function (v) {return isFinite(v) ? v.toString() : "null";}, Object:function (v) {if (v === null) {return "null";}var buf = [];for (var k in v) {if (!v.hasOwnProperty(k) || typeof k !== "string" || v[k] === undefined) {continue;}buf.push(toJSON(k, val) + ": " + toJSON(v[k]));}return "{" + buf.join(",") + "}";}, String:function (v) {if (/["\\\x00-\x1f]/.test(v)) {v = v.replace(/([\x00-\x1f\\"])/g, function (a, b) {var c = subs[b];if (c) {return c;}c = b.charCodeAt();return "\\u00" + Math.floor(c / 16).toString(16) + (c % 16).toString(16);});}return "\"" + v + "\"";}}[val != null ? val.constructor.name : "Object"] is not a function
> When really the problem is a ReferenceError (I should have used newDoc.foo or oldDoc.foo).  The attached patch modifies toJSON() in utils.js so that it converts anything that isn't a String, Array, Date, Object etc. into a String.  This makes the error appear in the popup in Futon when saving.
> This isn't necessarily the best thing to do as it modifies the semantics of toJSON(), and also we might want to keep the exception info in the logs, and not propagate it to the user.  Perhaps it would be better to modify respond(obj) to produce a better error message in the logs (simply adding something that tried to log obj.toString() would suffice).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COUCHDB-410) JavaScript errors in validate_doc_update should be handled more gracefully

Posted by "Jason Davies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-410?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jason Davies updated COUCHDB-410:
---------------------------------

    Attachment: util.js.diff

Patch that modifies toJSON() so that toJSON(ReferenceError("doc.foo is not defined")) works.

> JavaScript errors in validate_doc_update should be handled more gracefully
> --------------------------------------------------------------------------
>
>                 Key: COUCHDB-410
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-410
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Database Core
>    Affects Versions: 0.9.1, 0.10
>            Reporter: Jason Davies
>             Fix For: 0.9.1
>
>         Attachments: util.js.diff
>
>
> For example, if I create validate_doc_update:
> function (oldDoc, newDoc, userCtx) {
>   doc.myUndefinedProperty;
> }
> I am greeted by an "OS process timed out" message.  In the logs, all I see is:
> OS Process :: Error converting object to JSON: TypeError: {Array:function (v) {var buf = [];for (var i = 0; i < v.length; i++) {buf.push(toJSON(v[i]));}return "[" + buf.join(",") + "]";}, Boolean:function (v) {return v.toString();}, Date:function (v) {var f = function (n) {return n < 10 ? "0" + n : n;};return "\"" + v.getUTCFullYear() + "-" + f(v.getUTCMonth() + 1) + "-" + f(v.getUTCDate()) + "T" + f(v.getUTCHours()) + ":" + f(v.getUTCMinutes()) + ":" + f(v.getUTCSeconds()) + "Z\"";}, Number:function (v) {return isFinite(v) ? v.toString() : "null";}, Object:function (v) {if (v === null) {return "null";}var buf = [];for (var k in v) {if (!v.hasOwnProperty(k) || typeof k !== "string" || v[k] === undefined) {continue;}buf.push(toJSON(k, val) + ": " + toJSON(v[k]));}return "{" + buf.join(",") + "}";}, String:function (v) {if (/["\\\x00-\x1f]/.test(v)) {v = v.replace(/([\x00-\x1f\\"])/g, function (a, b) {var c = subs[b];if (c) {return c;}c = b.charCodeAt();return "\\u00" + Math.floor(c / 16).toString(16) + (c % 16).toString(16);});}return "\"" + v + "\"";}}[val != null ? val.constructor.name : "Object"] is not a function
> When really the problem is a ReferenceError.  The attached patch modifies toJSON() in utils.js so that it converts anything that isn't a String, Array, Date, Object etc. into a String.  This makes the error appear in the popup in Futon when saving.
> This isn't necessarily the best thing to do as it modifies the semantics of toJSON(), and also we might want to keep the exception info in the logs, and not propagate it to the user.  Perhaps it would be better to modify respond(obj) to produce a better error message in the logs (simply adding something that tried to log obj.toString() would suffice).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COUCHDB-410) JavaScript errors in validate_doc_update should be handled more gracefully

Posted by "Noah Slater (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-410?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Noah Slater updated COUCHDB-410:
--------------------------------

    Fix Version/s:     (was: 0.9.1)
                   0.9.2

> JavaScript errors in validate_doc_update should be handled more gracefully
> --------------------------------------------------------------------------
>
>                 Key: COUCHDB-410
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-410
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Database Core
>    Affects Versions: 0.9.1, 0.10
>            Reporter: Jason Davies
>             Fix For: 0.9.2
>
>         Attachments: util.js.diff
>
>
> For example, if I create validate_doc_update:
> function (oldDoc, newDoc, userCtx) {
>   doc.foo;
> }
> I am greeted by an "OS process timed out" message.  In the logs, all I see is:
> OS Process :: Error converting object to JSON: TypeError: {Array:function (v) {var buf = [];for (var i = 0; i < v.length; i++) {buf.push(toJSON(v[i]));}return "[" + buf.join(",") + "]";}, Boolean:function (v) {return v.toString();}, Date:function (v) {var f = function (n) {return n < 10 ? "0" + n : n;};return "\"" + v.getUTCFullYear() + "-" + f(v.getUTCMonth() + 1) + "-" + f(v.getUTCDate()) + "T" + f(v.getUTCHours()) + ":" + f(v.getUTCMinutes()) + ":" + f(v.getUTCSeconds()) + "Z\"";}, Number:function (v) {return isFinite(v) ? v.toString() : "null";}, Object:function (v) {if (v === null) {return "null";}var buf = [];for (var k in v) {if (!v.hasOwnProperty(k) || typeof k !== "string" || v[k] === undefined) {continue;}buf.push(toJSON(k, val) + ": " + toJSON(v[k]));}return "{" + buf.join(",") + "}";}, String:function (v) {if (/["\\\x00-\x1f]/.test(v)) {v = v.replace(/([\x00-\x1f\\"])/g, function (a, b) {var c = subs[b];if (c) {return c;}c = b.charCodeAt();return "\\u00" + Math.floor(c / 16).toString(16) + (c % 16).toString(16);});}return "\"" + v + "\"";}}[val != null ? val.constructor.name : "Object"] is not a function
> When really the problem is a ReferenceError (I should have used newDoc.foo or oldDoc.foo).  The attached patch modifies toJSON() in utils.js so that it converts anything that isn't a String, Array, Date, Object etc. into a String.  This makes the error appear in the popup in Futon when saving.
> This isn't necessarily the best thing to do as it modifies the semantics of toJSON(), and also we might want to keep the exception info in the logs, and not propagate it to the user.  Perhaps it would be better to modify respond(obj) to produce a better error message in the logs (simply adding something that tried to log obj.toString() would suffice).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COUCHDB-410) JavaScript errors in validate_doc_update should be handled more gracefully

Posted by "Adam Kocoloski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-410?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adam Kocoloski updated COUCHDB-410:
-----------------------------------

    Fix Version/s:     (was: 0.9.2)
                   0.11

I don't think there's going to be an 0.9.2, adjusting FixFor to 0.11

> JavaScript errors in validate_doc_update should be handled more gracefully
> --------------------------------------------------------------------------
>
>                 Key: COUCHDB-410
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-410
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Database Core
>    Affects Versions: 0.9.1, 0.10
>            Reporter: Jason Davies
>             Fix For: 0.11
>
>         Attachments: util.js.diff
>
>
> For example, if I create validate_doc_update:
> function (oldDoc, newDoc, userCtx) {
>   doc.foo;
> }
> I am greeted by an "OS process timed out" message.  In the logs, all I see is:
> OS Process :: Error converting object to JSON: TypeError: {Array:function (v) {var buf = [];for (var i = 0; i < v.length; i++) {buf.push(toJSON(v[i]));}return "[" + buf.join(",") + "]";}, Boolean:function (v) {return v.toString();}, Date:function (v) {var f = function (n) {return n < 10 ? "0" + n : n;};return "\"" + v.getUTCFullYear() + "-" + f(v.getUTCMonth() + 1) + "-" + f(v.getUTCDate()) + "T" + f(v.getUTCHours()) + ":" + f(v.getUTCMinutes()) + ":" + f(v.getUTCSeconds()) + "Z\"";}, Number:function (v) {return isFinite(v) ? v.toString() : "null";}, Object:function (v) {if (v === null) {return "null";}var buf = [];for (var k in v) {if (!v.hasOwnProperty(k) || typeof k !== "string" || v[k] === undefined) {continue;}buf.push(toJSON(k, val) + ": " + toJSON(v[k]));}return "{" + buf.join(",") + "}";}, String:function (v) {if (/["\\\x00-\x1f]/.test(v)) {v = v.replace(/([\x00-\x1f\\"])/g, function (a, b) {var c = subs[b];if (c) {return c;}c = b.charCodeAt();return "\\u00" + Math.floor(c / 16).toString(16) + (c % 16).toString(16);});}return "\"" + v + "\"";}}[val != null ? val.constructor.name : "Object"] is not a function
> When really the problem is a ReferenceError (I should have used newDoc.foo or oldDoc.foo).  The attached patch modifies toJSON() in utils.js so that it converts anything that isn't a String, Array, Date, Object etc. into a String.  This makes the error appear in the popup in Futon when saving.
> This isn't necessarily the best thing to do as it modifies the semantics of toJSON(), and also we might want to keep the exception info in the logs, and not propagate it to the user.  Perhaps it would be better to modify respond(obj) to produce a better error message in the logs (simply adding something that tried to log obj.toString() would suffice).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COUCHDB-410) JavaScript errors in validate_doc_update should be handled more gracefully

Posted by "Jason Davies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-410?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jason Davies updated COUCHDB-410:
---------------------------------

    Description: 
For example, if I create validate_doc_update:

function (oldDoc, newDoc, userCtx) {
  doc.foo;
}

I am greeted by an "OS process timed out" message.  In the logs, all I see is:

OS Process :: Error converting object to JSON: TypeError: {Array:function (v) {var buf = [];for (var i = 0; i < v.length; i++) {buf.push(toJSON(v[i]));}return "[" + buf.join(",") + "]";}, Boolean:function (v) {return v.toString();}, Date:function (v) {var f = function (n) {return n < 10 ? "0" + n : n;};return "\"" + v.getUTCFullYear() + "-" + f(v.getUTCMonth() + 1) + "-" + f(v.getUTCDate()) + "T" + f(v.getUTCHours()) + ":" + f(v.getUTCMinutes()) + ":" + f(v.getUTCSeconds()) + "Z\"";}, Number:function (v) {return isFinite(v) ? v.toString() : "null";}, Object:function (v) {if (v === null) {return "null";}var buf = [];for (var k in v) {if (!v.hasOwnProperty(k) || typeof k !== "string" || v[k] === undefined) {continue;}buf.push(toJSON(k, val) + ": " + toJSON(v[k]));}return "{" + buf.join(",") + "}";}, String:function (v) {if (/["\\\x00-\x1f]/.test(v)) {v = v.replace(/([\x00-\x1f\\"])/g, function (a, b) {var c = subs[b];if (c) {return c;}c = b.charCodeAt();return "\\u00" + Math.floor(c / 16).toString(16) + (c % 16).toString(16);});}return "\"" + v + "\"";}}[val != null ? val.constructor.name : "Object"] is not a function

When really the problem is a ReferenceError (I should have used newDoc.foo or oldDoc.foo).  The attached patch modifies toJSON() in utils.js so that it converts anything that isn't a String, Array, Date, Object etc. into a String.  This makes the error appear in the popup in Futon when saving.

This isn't necessarily the best thing to do as it modifies the semantics of toJSON(), and also we might want to keep the exception info in the logs, and not propagate it to the user.  Perhaps it would be better to modify respond(obj) to produce a better error message in the logs (simply adding something that tried to log obj.toString() would suffice).

  was:
For example, if I create validate_doc_update:

function (oldDoc, newDoc, userCtx) {
  doc.myUndefinedProperty;
}

I am greeted by an "OS process timed out" message.  In the logs, all I see is:

OS Process :: Error converting object to JSON: TypeError: {Array:function (v) {var buf = [];for (var i = 0; i < v.length; i++) {buf.push(toJSON(v[i]));}return "[" + buf.join(",") + "]";}, Boolean:function (v) {return v.toString();}, Date:function (v) {var f = function (n) {return n < 10 ? "0" + n : n;};return "\"" + v.getUTCFullYear() + "-" + f(v.getUTCMonth() + 1) + "-" + f(v.getUTCDate()) + "T" + f(v.getUTCHours()) + ":" + f(v.getUTCMinutes()) + ":" + f(v.getUTCSeconds()) + "Z\"";}, Number:function (v) {return isFinite(v) ? v.toString() : "null";}, Object:function (v) {if (v === null) {return "null";}var buf = [];for (var k in v) {if (!v.hasOwnProperty(k) || typeof k !== "string" || v[k] === undefined) {continue;}buf.push(toJSON(k, val) + ": " + toJSON(v[k]));}return "{" + buf.join(",") + "}";}, String:function (v) {if (/["\\\x00-\x1f]/.test(v)) {v = v.replace(/([\x00-\x1f\\"])/g, function (a, b) {var c = subs[b];if (c) {return c;}c = b.charCodeAt();return "\\u00" + Math.floor(c / 16).toString(16) + (c % 16).toString(16);});}return "\"" + v + "\"";}}[val != null ? val.constructor.name : "Object"] is not a function

When really the problem is a ReferenceError.  The attached patch modifies toJSON() in utils.js so that it converts anything that isn't a String, Array, Date, Object etc. into a String.  This makes the error appear in the popup in Futon when saving.

This isn't necessarily the best thing to do as it modifies the semantics of toJSON(), and also we might want to keep the exception info in the logs, and not propagate it to the user.  Perhaps it would be better to modify respond(obj) to produce a better error message in the logs (simply adding something that tried to log obj.toString() would suffice).


Clarified what the error is in my example.

> JavaScript errors in validate_doc_update should be handled more gracefully
> --------------------------------------------------------------------------
>
>                 Key: COUCHDB-410
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-410
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Database Core
>    Affects Versions: 0.9.1, 0.10
>            Reporter: Jason Davies
>             Fix For: 0.9.1
>
>         Attachments: util.js.diff
>
>
> For example, if I create validate_doc_update:
> function (oldDoc, newDoc, userCtx) {
>   doc.foo;
> }
> I am greeted by an "OS process timed out" message.  In the logs, all I see is:
> OS Process :: Error converting object to JSON: TypeError: {Array:function (v) {var buf = [];for (var i = 0; i < v.length; i++) {buf.push(toJSON(v[i]));}return "[" + buf.join(",") + "]";}, Boolean:function (v) {return v.toString();}, Date:function (v) {var f = function (n) {return n < 10 ? "0" + n : n;};return "\"" + v.getUTCFullYear() + "-" + f(v.getUTCMonth() + 1) + "-" + f(v.getUTCDate()) + "T" + f(v.getUTCHours()) + ":" + f(v.getUTCMinutes()) + ":" + f(v.getUTCSeconds()) + "Z\"";}, Number:function (v) {return isFinite(v) ? v.toString() : "null";}, Object:function (v) {if (v === null) {return "null";}var buf = [];for (var k in v) {if (!v.hasOwnProperty(k) || typeof k !== "string" || v[k] === undefined) {continue;}buf.push(toJSON(k, val) + ": " + toJSON(v[k]));}return "{" + buf.join(",") + "}";}, String:function (v) {if (/["\\\x00-\x1f]/.test(v)) {v = v.replace(/([\x00-\x1f\\"])/g, function (a, b) {var c = subs[b];if (c) {return c;}c = b.charCodeAt();return "\\u00" + Math.floor(c / 16).toString(16) + (c % 16).toString(16);});}return "\"" + v + "\"";}}[val != null ? val.constructor.name : "Object"] is not a function
> When really the problem is a ReferenceError (I should have used newDoc.foo or oldDoc.foo).  The attached patch modifies toJSON() in utils.js so that it converts anything that isn't a String, Array, Date, Object etc. into a String.  This makes the error appear in the popup in Futon when saving.
> This isn't necessarily the best thing to do as it modifies the semantics of toJSON(), and also we might want to keep the exception info in the logs, and not propagate it to the user.  Perhaps it would be better to modify respond(obj) to produce a better error message in the logs (simply adding something that tried to log obj.toString() would suffice).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.