index.js
function defaultErrorHandler(err, req, res) {
  if (err.name === 'UnauthorizedError') { // authentication is expected to be a common use-case
    res.status(401).end();
  } else {
    if (!err.status || err.status >= 500) {
      console.error(err.stack || err.toString());
    }
    res.status(err.status || 500).json({message: err.message})
  }
}
function defaultErrorHandler(err, req, res) {
  if (err.name === 'UnauthorizedError') { // authentication is expected to be a common use-case
    res.status(401).end();
  } else {
    if (!err.status || err.status >= 500) {
      console.error(err.stack || err.toString());
    }
    res.status(err.status || 500).json({message: err.message})
  }
}
function defaultErrorHandler ( err , req , res ) { if ( err . name === 'UnauthorizedError' ) { // authentication is expected to be a common use-case res . status ( 401 ) . end ( ) ; } else { if ( ! err . status || err . status >= 500 ) { console . error ( err . stack || err . toString ( ) ) ; } res . status ( err . status || 500 ) . json ( { message : err . message } ) } }
The default error handler, in case none is provided by the application.
@private
The default error handler in case none is provided by the application .