From 3e47bfd6586f42f9fe8e49cea03c4df976c781a1 Mon Sep 17 00:00:00 2001 From: John Christopher Anderson Date: Sat, 18 Apr 2009 20:15:44 +0000 Subject: 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 --- share/www/script/test/list_views.js | 12 ++++++++++++ share/www/script/test/show_documents.js | 7 +++++++ 2 files changed, 19 insertions(+) (limited to 'share/www') 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(/

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"); -- cgit v1.2.3