Handling errors
In microservice architectures, you will have many applications communicating together to form a larger system. When you have a system formed of many moving parts, it's important to handle errors within the system appropriately.
In this recipe, we will consider how you can handle errors in a Node.js application.
Getting ready
In this recipe, we're going to reuse the frontend web application we created in the previous recipe, Consuming a microservice. If you haven't completed that recipe, you can obtain the code from the Packt GitHub repository at https://github.com/PacktPublishing/Node.js-14-Cookbook in the Chapter11/bookstore-web-app
directory.
Start by copying the contents of the bookstore-web-app
directory to a new directory named bookstore-error-handling
:
$ cp -r bookstore-web-app bookstore-error-handling $ cd bookstore-error-handling
Now, we’re ready to move on to the recipe.
How to do it…
- In this recipe...