diff options
author | John Christopher Anderson <jchris@apache.org> | 2009-04-18 20:15:44 +0000 |
---|---|---|
committer | John Christopher Anderson <jchris@apache.org> | 2009-04-18 20:15:44 +0000 |
commit | 3e47bfd6586f42f9fe8e49cea03c4df976c781a1 (patch) | |
tree | b3ae7a8203f2d4ec99a84762ea9aedda56864d88 /share/www | |
parent | daa9d65a53dedaac5aeeb6394d4c0b6f99fa930c (diff) |
refactor main.js into many files and improve show/list error handling
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@766383 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www')
-rw-r--r-- | share/www/script/test/list_views.js | 12 | ||||
-rw-r--r-- | share/www/script/test/show_documents.js | 7 |
2 files changed, 19 insertions, 0 deletions
diff --git a/share/www/script/test/list_views.js b/share/www/script/test/list_views.js index e71ebc4e..0bf03900 100644 --- a/share/www/script/test/list_views.js +++ b/share/www/script/test/list_views.js @@ -130,6 +130,15 @@ couchTests.list_views = function(debug) { }), emptyList: stringFun(function(head, row, req, row_info) { return { body: "" }; + }), + rowError : stringFun(function(head, row, req, row_info) { + if (head) { + return "head"; + } else if(row) { + return missingValue; + } else { + return "tail" + } }) } }; @@ -272,4 +281,7 @@ couchTests.list_views = function(debug) { }); T(xhr.status == 400); T(/query_parse_error/.test(xhr.responseText)); + + var xhr = CouchDB.request("GET", "/test_suite_db/_design/lists/_list/rowError/basicView"); + T(/<h1>Render Error<\/h1>/.test(xhr.responseText)); }; diff --git a/share/www/script/test/show_documents.js b/share/www/script/test/show_documents.js index c755898e..bf12e4c6 100644 --- a/share/www/script/test/show_documents.js +++ b/share/www/script/test/show_documents.js @@ -54,6 +54,9 @@ couchTests.show_documents = function(debug) { json : req } }), + "render-error" : stringFun(function(doc, req) { + return noSuchVariable; + }), "xml-type" : stringFun(function(doc, req) { return { "headers" : { @@ -142,6 +145,10 @@ couchTests.show_documents = function(debug) { // hello template world xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/hello/"+docid); T(xhr.responseText == "Hello World"); + + // error stacktraces + xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/render-error/"+docid); + T(JSON.parse(xhr.responseText).error == "render_error"); // hello template world (no docid) xhr = CouchDB.request("GET", "/test_suite_db/_design/template/_show/hello"); |