Currently, I am routing each page to my Controller pages that cannot be found in previous routes by including this line in routes.js:
this.match('/:page', { controller: 'pages', action: 'show' });
I had the idea that my PagesController descriptor would serve 404 if not found:
PagesController.show = function() {
var page = this.param('page');
if(page != undefined){
page = page.replace(".html","");
try {
this.render("./"+page);
} catch(error){
this.redirect({action : "404"});
};
}
return;
};
But my idea fails. An error cannot be detected, so the fatal signal will still be serviced. Should I add fn to the render call? What are the arguments? How it works? (/ simple questions).
source
share