-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Promise not rejected on CastError #3512
Labels
Milestone
Comments
Thanks for pointing this out, will fix. |
So this would qualify as a backwards breaking change, because I would imagine some people still do try {
query = Model.update({ _id: 'foo' });
} catch(err) {}
query.exec(); because that's part of mongoose's API. That will change in 5.0, however, till then, doc.update( { _id: 'foo' }, { $push:{ bar: value} }, { dontThrowCastError: true } ).then( onFulfilled , onRejected ) is the best we can do for 4.2.4 unfortunately. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is a inconsistent behavior in the API related to error handling on callback vs promise flow.
In the following code,
onRejected
is never called and a MongooseError ( CastError ) is thrownBut in the callback variant the callback function is called properly with the error.
The text was updated successfully, but these errors were encountered: