I have code like this that will render a jade template without a route defined. Think of this like the express.static but it calls res.render with the url.
app.use(function (req, res, next) {
try {
res.render(req.url.substring(1), { title: "No Controller", user: req.session.user });
} catch (err) {
console.log(err)
next();
}
});
The problem is that res.render() isn't throwing an error. Instead it is rendering an error page. Is there a way to detect a missing template or any rendering errors?