Make non-us itunes links work

This commit is contained in:
Jonathan Cremin 2014-12-06 21:12:52 +00:00
parent a471a984f8
commit e87dd27885
2 changed files with 27 additions and 9 deletions

View file

@ -12,7 +12,7 @@ require("fs").readdirSync(path.join(__dirname, "..", "lib", "services")).forEach
}
});
module.exports = function(req, res) {
module.exports = function(req, res, next) {
var url = parse(req.body.url);
var searching = false;
@ -35,13 +35,17 @@ module.exports = function(req, res) {
if (error.code == "ETIMEDOUT") {
error = new Error("Error talking to music service");
error.status = "502";
next(error);
} else if (!error.status) {
error = new Error("An unexpected error happenend");
error.status = 500;
next(error);
} else if (error.status == 404){
req.flash('search-error', 'No match found for this link');
res.redirect('/');
}
next(error);
});
});
break;
}
}