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

  • 關於本站
  • 免責聲明