logo
  • 教程列表
  • SO官方文档
  • Koa Framework v2
    • Hello World 示例
    • 使用中间件处理错误
  1. StackOverflow 文档
  2. Node.js 教程
  3. Koa Framework v2
  4. 使用中间件处理错误

使用中间件处理错误

Created: November-22, 2018

app.use(async (ctx, next) => {
  try {
    await next() // attempt to invoke the next middleware downstream
  } catch (err) {
    handleError(err, ctx) // define your own error handling function
  }
})
  • Hello World 示例

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 关于我们
  • 免责声明