Repository navigation
feat: improved error reporting on associations - #14901
Conversation
WikiRik
left a comment
There was a problem hiding this comment.
The four comments are about the same thing.
The styling changes have made it more difficult to review this PR, but I've went through it all and did not see any other changes so we should be okay
ephys
left a comment
There was a problem hiding this comment.
Thank you for the PR. That error message definitely deserved some improvements
I'm sorry to ask this but could you revert the stylistic changes? They increase the risk of conflict with the other PRs, make this PR more difficult to read as well the the commit history. We'd like to restrict style changes to PRs dedicated to that.
This improves the error reporting on associations by telling us what exactly is not a proper subclass of the Sequelize Model. This assists in debugging and should present little risk to the existing behavior. Possibly due to sequelize#14161 I was not able to get the full test suite running locally _before_ I made any local changes. However, the number of tests that were failing (2) remained the same after my changes, and the failing tests had more to do with SQLite than changes to the model structure.
a06b558 to
3e7a015
Compare
WikiRik
left a comment
There was a problem hiding this comment.
Just a small readability suggestion.
Also, can you look into the previous comment as well?
You're thinking we should have two paths here for the error message: One for when the error is clearly incorrect (
nullorundefined) vs. another when the object passed is not a subclass ofSequelize.Model.Something like this between the two error messages?
For
undefinedet. al:`User.hasOne` called with undefined but needs to be an object that is a subclass of `Sequelize.Model`For an object that's not the right subclass:
`User.hasOne` called with an object that's not a subclass of `Sequelize.Model`
WikiRik
left a comment
There was a problem hiding this comment.
I've gone ahead and committed my suggestion so we should be good to go! Thanks for working on this!
|
@WikiRik thanks so much for dragging this over the finish line! We got pretty caught up with some work duties. |
Pull Request Checklist
Please make sure to review and check all of these items:
yarn testoryarn test-DIALECTpass with this change (including linting)?Description Of Change
This improves the error reporting on associations by telling us what exactly is
not a proper subclass of the Sequelize Model. This assists in debugging and
should present little risk to the existing behavior.
Possibly due to #14161 I was not able to get the full test suite running
locally before I made any local changes. However, the number of tests that
were failing (2) remained the same after my changes, and the failing tests had
more to do with SQLite than changes to the model structure.
Thanks for maintaining such an awesome open source project!