diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2012-07-17 00:32:34 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2012-07-17 00:32:34 +0200 |
commit | 1b3785da5935fb7d1bf983b727ab7ed95d5f6ab0 (patch) | |
tree | 1c11df323c1369f7cc25ff1d055f24ea50ecff07 | |
parent | 1d6204901ccffa029c7beec7ff0fc15ee60a964f (diff) | |
download | collection-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.js | 6 |
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(); } |