app.error() in 4.x #1546

Closed
stuartpb opened this Issue Mar 18, 2013 · 1 comment

Comments

Projects
None yet
2 participants

(from the roadmap)

I don't get how app.error() would work. Would it be like, instead of

app.use(function(err,req,res,next){
  res.status(500);
  res.render('error', { error: err });
})

you would use

app.error = function(err){
  res.status(500);
  res.render('error', { error: err });
}

or is it like

app.use(function(err,req,res,next){
  if(!req.params.user) app.error(new Error("we never should have come here"))
})

and then that starts calling all the error middleware? I don't really see the gain either way

Member

jonathanong commented Sep 9, 2013

i'm gonna close this as it's not an "issue". you can ask this question on the mailing list.

however, you may be interested in koajs, which is what TJ is working on next. currently, app.error() makes much more sense. who knows what's going to happen in express 4.x

jonathanong closed this Sep 9, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment