-
-
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
fix(update): set CastError path to full path if casting update fails #14161
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good to me, though what about other types like uuid
or Decimal128
or does this only apply to this.applySetters
calls?
@hasezoey this change is just for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good to me, though it seems deno does not like the UUID change
@hasezoey the deno issue looks unrelated, it's an unfortunate quirk with how our tests are written: |
Fix #14114
Summary
Currently, CastError only shows the path relative to parent, which is less than ideal in the case where casting update throws an error; in that case, Mongoose just throws the CastError, rather than wrapping the CastError in a
ValidationError
like howsave()
does. This PR makes CastError use$fullPath
instead when casting updatesExamples