Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

error handling in node.js

app.use(( err, req, res, next ) => {
  res.locals.error = err;
  if (err.status >= 100 && err.status < 600)
    res.status(err.status);
  else
    res.status(500);
  res.render('error');
});
Source by expressjs.com #
 
PREVIOUS NEXT
Tagged: #error #handling
ADD COMMENT
Topic
Name
8+4 =