3 ms·
Already fixed in Express 5 (which is technically still in beta, but that just seems to be the maintainer being very conservative about a major release): https:/
by cipheredStones 3y ago
Already fixed in Express 5 (which is technically still in beta, but that just seems to be the maintainer being very conservative about a major release): https://expressjs.com/en/guide/error-handling.html https://expressjs.com/en/guide/error-handling.html
> Starting with Express 5, route handlers and middleware that return a Promise will call next(value) automatically when they reject or throw an error. For example:
> app.get('/user/:id', async (req, res, next) => { const user = await getUserById(req.params.id); res.send(user) })
> If getUserById throws an error or rejects, next will be called with either the thrown error or the rejected value. If no rejected value is provided, next will be called with a default Error object provided by the Express router.
- re-thc 3y ago> which is technically still in beta, but that just seems to be the maintainer being very conservative about a major release There hasn't been a new beta in a long time. Last release about a year ago and then the 1 before that about 3 years ago. Not a very convincing beta.
- cipheredStones 3y agoI'm not sure whether you mean "not very convincing" in the sense of "not reassuring that it works" or something else, but judging from users' comments on this issue about the release plans, it seems to work just fine: https://github.com/expressjs/express/issues/4920 https://github.com/expressjs/express/issues/4920 The maintainer said this three months ago in a comment on that issue: > Express 5 is pretty much completed at this point, and we're just finishing up the last code merges in upstream modules in order to bump the dependencies finally in the 5.0 branch.
- re-thc 3y ago> it seems to work just fine Like how Windows XP on an old computer still "works just fine"? What does work just fine in terms of software that's ever updating mean? It doesn't matter if it's called 4 or 5 or any other label. On the comments: my point is more that we should not base the NodeJs standard on something that's not regularly maintained / updated. There are infinite amount of things that can be improved on for a "standard" server framework used by millions. You don't say Node "is done" and leave it? People would definitely fork it or move on (as happened in the past).