The big problem is Express code like the following will either hang the HTTP request
forever (--unhandled-rejections=warn), until the client times out and gives up, or crash your whole server, taking down any other HTTP requests in progress (--unhandled-rejections=throw):
const db = {
async getUsers() {
throw new Error("failed to connect to database");
},
};
app.get("/", async (req, res) => {
const result = await db.getUsers();
return result;
});
There are various monkey patches/wrappers you can use to make async errors work the same as sync errors, but it is easy to forget and hard to understand, especially for newbies. Many other frameworks handle async/sync errors in a more consistent way.