Better handling of invalid ids
This commit is contained in:
parent
c8eb31116c
commit
a33570e1d0
2 changed files with 10 additions and 5 deletions
|
@ -60,11 +60,14 @@ module.exports = function(req, res, next) {
|
|||
cache[serviceId][type + "-" + itemId] = items;
|
||||
res.render(type, {page: type, items: items});
|
||||
});
|
||||
}, function(err) {
|
||||
var error = new Error("An unexpected error happenend")
|
||||
if (err.code == "ETIMEDOUT") {
|
||||
}, function(error) {
|
||||
console.log(error)
|
||||
if (error.code == "ETIMEDOUT") {
|
||||
error = new Error("Error talking to music service");
|
||||
error.status = "502";
|
||||
} else if (!error.status) {
|
||||
error = new Error("An unexpected error happenend");
|
||||
error.status = 500;
|
||||
}
|
||||
next(error);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue