// 注:异常处理一
  app.use(function (err, req, res, next) {
    console.error(err.stack)
    var body = createHtmlDocument(err.stack)
    res.end(body, 'utf8')

    sendErrCourier(err.stack)
  })
  app.listen(app.get('port'), function () {
    console.log('listening port ' + app.get('port'))
  })
  // 注:异常处理二
  process.on('uncaughtException', function (err) {
    console.log(err.stack)
    sendErrCourier(err.stack)
  })
  // 注:异常处理三
  process.on('unhandledRejection', (reason, p) => {
    console.log('Unhandled Rejection at: Promise', p, 'reason:', reason)
    sendErrCourier(reason)
  })
// 注:警告处理
process.on('warning', e => console.warn(e.stack)); 

function sendErrCourier(msg) {
  // do send message
}