Error handling is the process of an application catching errors and processing them. These errors usually occur during runtime of an application. It does not matter if an error is synchronous or asynchronous. A default error handler is embedded by default in Express.js hence, it's not required for you to write a specific error handler to get started on a new application as we did.
It is necessary for Express.js to catch any errors that occur while running route handlers and middleware, otherwise errors will be lost. As mentioned, there are some default error handlers for errors that occur in synchronous code inside route handlers and middleware. In the case of default error handlers, no extra work is needed. In other words, if asynchronous code throws an error, then Express.js will catch it and process it by default, as in the following example:
export let...