Koa.js Error Handling - Koa.js

How errors are handled in Koa.js?

Errors are handled by Koa with the help of middlewares. Initially, Koa adds a middleware try {yield next}, in case any error is encountered, the error are handled by returning to the catch clause associated. For instance,

In the above code, error is created and handled in the first catch block of the middleware, then moved to the console and response is sent to the client. The error message that appears on triggering the error is:

At this point, all the requests to the server turn up into errors.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Koa.js Topics