summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2012-07-17 00:32:34 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2012-07-17 00:32:34 +0200
commit1b3785da5935fb7d1bf983b727ab7ed95d5f6ab0 (patch)
tree1c11df323c1369f7cc25ff1d055f24ea50ecff07
parent1d6204901ccffa029c7beec7ff0fc15ee60a964f (diff)
downloadcollection-json-explorer-1b3785da5935fb7d1bf983b727ab7ed95d5f6ab0.tar.gz
collection-json-explorer-1b3785da5935fb7d1bf983b727ab7ed95d5f6ab0.tar.bz2
collection-json-explorer-1b3785da5935fb7d1bf983b727ab7ed95d5f6ab0.tar.xz
collection-json-explorer-1b3785da5935fb7d1bf983b727ab7ed95d5f6ab0.zip
o Some error handling.
-rw-r--r--routes/index.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/routes/index.js b/routes/index.js
index 7ae3aa0..af06e4a 100644
--- a/routes/index.js
+++ b/routes/index.js
@@ -7,6 +7,10 @@ var collection_json = require('collection_json')
function split(str) {
var u = url.parse(str);
+ if(typeof u.pathname != 'string') {
+ return [str];
+ }
+
var segments = u.pathname.replace(/\/$/, '').split('/');
var splits = _.map(_.range(segments.length), function(i) {
@@ -96,7 +100,7 @@ exports.delete = function(req, res) {
});
});
}).on('error', function(e) {
- done(util.inspect(e));
+ done(util.inspect(e));
}).end();
}