summaryrefslogtreecommitdiff
path: root/share/www/script/test/view_errors.js
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2009-02-18 07:47:57 +0000
committerJohn Christopher Anderson <jchris@apache.org>2009-02-18 07:47:57 +0000
commitd778d2a96042dc06432c6abaea7da871b4dd4142 (patch)
treec3465d350672397c0eda04418543335a65561d59 /share/www/script/test/view_errors.js
parent3b431fc0b30c5fb110afd06347058727724f0fb2 (diff)
Better error messages on decoding invalid JSON. Changes the CouchDB version of mochijson2. Closes COUCHDB-258
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@745401 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/test/view_errors.js')
-rw-r--r--share/www/script/test/view_errors.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/share/www/script/test/view_errors.js b/share/www/script/test/view_errors.js
index a8a9be7d..66fdfa69 100644
--- a/share/www/script/test/view_errors.js
+++ b/share/www/script/test/view_errors.js
@@ -40,4 +40,13 @@ couchTests.view_errors = function(debug) {
emit([doc._id, doc.undef], null);
});
T(results.total_rows == 0);
+
+ // querying a view with invalid params should give a resonable error message
+ var xhr = CouchDB.request("POST", "/test_suite_db/_temp_view?startkey=foo", {
+ headers: {"Content-Type": "application/json"},
+ body: JSON.stringify({language: "javascript",
+ map : "function(doc){emit(doc.integer)}"
+ })
+ });
+ T(JSON.parse(xhr.responseText).error == "invalid_json");
};