From 1b3785da5935fb7d1bf983b727ab7ed95d5f6ab0 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Tue, 17 Jul 2012 00:32:34 +0200 Subject: o Some error handling. --- routes/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'routes') 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(); } -- cgit v1.2.3