Handling errors using middleware
suggest changeapp.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
}
})
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents