next() callback does not call the error handler for any falsy value.
In the case of
throw undefined I see that this is cumbersome (in the former case even impossible, but in the latter case a flag could be set where the exception is caught).
The other cases could be handled by explicitly comparing to
The reason I’d like to see this is that passing something to
next() that is not
undefined is almost always something one wants to handle. If it comes from a third party library the developer might not even know that it could return something falsy. Or a third party library could throw something falsy and that is something one wants to know. At the moment express swallows this and responds with a 404. Stumbling onto this issue could take some time to debug.
I know that throwing 0, ”, false etc. is something that should not be done, but the fact is that everyone who relies on third party code (without completely reviewing it) will eventually hit this case.
I’m also aware that this would be a breaking change, I just wanted to raise the issue and start a discussion.