-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
mongoose plugin requires first argument of "next" be type of Error #2441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for heads up, sorry finding this bug was such a hassle |
I was trying to figure out why it was silently failing. Thanks for this. |
@yads @mocheng It turns out that this is not a bug but how the hooks npm package is supposed to work. Nevertheless, I agree that this behavior is not straight-forward. Mongoose depends on that package for defining According to the documentation on the hooks docs page, |
added tests to verify that passing error and non-error messages through ...
That's very interesting and definitely a non standard way to use middleware. Thanks for looking into it. |
Yeah I agree this is a little bit weird. I'd be open to a discussion to change this behavior. |
|
It cost me hours to figure out bug in below code.
If
next
is invoked with first argument as object not inError
type, it just silently fail without trigger callback ofsave
.I believe this should be improved.
next
can transfer first argument intoError
if it is string or else.The text was updated successfully, but these errors were encountered: