In this chapter, we have learned how error handling in Koa works out of the box. We have learned, with code examples, how to define and register our own custom error-handling middleware. We also learned about the error event in Koa and how to define listeners for centralized logging and other purposes.
The use of async... await in Koa makes error handling a lot easier than in traditional middleware-based frameworks, as we simply have to define try... catch statements to do most of the heavy lifting.
Proper error handling is a must-have for almost all applications going into production. This is another reason why Koa is such a great choice for production-grade HTTP applications.
In the next chapter, we will be building a Koa application from scratch, and we will utilize all the information we have learned from the previous lessons.