-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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(model): Made sure errors with messages are passed to AggregateError for bulk creates. #9133
fix(model): Made sure errors with messages are passed to AggregateError for bulk creates. #9133
Conversation
…or for bulk creates. Previously objects passed to the AggregateError did not have a message property, causing them to be rendered as [object Object] in the console log. This change fixes the issue of a missing message property fix sequelize#8989
Removed some leftover debugging and update the documentation
…or for bulk creates. Changed the punctuation in a docblock
lib/model.js
Outdated
* Simply extending the value of `err` would cause a breaking change as the `errors` | ||
* property is expected on each item in the array of errors. | ||
*/ | ||
errors.push(new sequelizeErrors.RecordLinkedError(err, instance)); |
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.
Why not just push validation error
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.
It would cause a breaking change, a property of record
and errors
is expected in each item.
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.
I think we can simply do this
err.record = instance;
errors.push(err);
In v5 we can remove record
as instance
property is already available in ValidationErrorItem
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.
Thanks for this contribution, I made some improvement now its good to og
🎉 This PR is included in version 4.35.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Hey thanks, sorry I've been afk all week |
Pull Request check-list
Please make sure to review and check all of these items:
npm run test
ornpm run test-DIALECT
pass with this change (including linting)?Description of change
Previously objects passed to the AggregateError did not have a message property, causing them to be
rendered as [object Object] in the console log. This change fixes the issue of a missing message
property.
fixes #8989