basic erro r handling for 404 sites
This commit is contained in:
@ -4,9 +4,12 @@ module.exports = {
|
||||
// Find site by ID export
|
||||
findById: function(req, res){
|
||||
Site.findById(req.params.id, function(err, site){
|
||||
if(err) throw err;
|
||||
console.log("Site->Controller: findById queried: " + site.site);
|
||||
res.render('site', { title: site.site, site: site });
|
||||
// if(err) throw err;
|
||||
if(err) res.render('index', { title: 'Site is not found!'});
|
||||
else {
|
||||
console.log("Site->Controller: findById queried: " + site.site);
|
||||
res.render('site', { title: site.site, site: site });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user