Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

express error middleware

function errorHandler (err, req, res, next) {
  if (res.headersSent) {
    return next(err)
  }
  res.status(500)
  res.render('error', { error: err })
}
Source by expressjs.com #
 
PREVIOUS NEXT
Tagged: #express #error #middleware
ADD COMMENT
Topic
Name
3+6 =