summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2012-07-02 23:17:32 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2012-07-02 23:17:32 +0200
commite1bcf8ffdd858706f50232896e25ca82ce911517 (patch)
tree6397c53d11deb9bf67718cc7de1d864da68b0db1
parent021dc27bd0101f24cd615b187938fbadf5fdcc89 (diff)
downloadcollection-json-explorer-e1bcf8ffdd858706f50232896e25ca82ce911517.tar.gz
collection-json-explorer-e1bcf8ffdd858706f50232896e25ca82ce911517.tar.bz2
collection-json-explorer-e1bcf8ffdd858706f50232896e25ca82ce911517.tar.xz
collection-json-explorer-e1bcf8ffdd858706f50232896e25ca82ce911517.zip
o Better error messages when unable to parse JSON.
o Fixing typos.
-rw-r--r--routes/index.js5
-rw-r--r--views/data.jade7
2 files changed, 9 insertions, 3 deletions
diff --git a/routes/index.js b/routes/index.js
index efed59c..5f2c79c 100644
--- a/routes/index.js
+++ b/routes/index.js
@@ -42,7 +42,10 @@ exports.render = function(req, res) {
var parsedBody;
try {
parsedBody = JSON.parse(body);
- } catch(e) { sendErr('Unable to parse JSON: ' + e); }
+ } catch(e) {
+ sendErr('Unable to parse JSON: ' + e);
+ return;
+ }
var collection = collection_json.fromObject(parsedBody).collection;
var isUrl = function(u) {
try {
diff --git a/views/data.jade b/views/data.jade
index 49d0579..78d8b76 100644
--- a/views/data.jade
+++ b/views/data.jade
@@ -66,7 +66,7 @@ block meta
// TODO: Add ability to show the raw part of the collection.
block items
if collection.items.length == 0
- p Collection has to items.
+ p Collection has no items.
else
// p The feed has #{collection.items.length} items.
each item, i in collection.items
@@ -91,7 +91,7 @@ block items
block queries
if collection.queries.length == 0
- p Collection has to queries.
+ p Collection has no queries.
else
each query in collection.queries
- var name = query.prompt || query.name || 'Unnamed query'
@@ -155,6 +155,9 @@ block navbar
block content
if typeof err != 'undefined'
+ section(id='error')
+ div(class='page-error')
+ h1 Error
p Error rendering #{url}
p= err