undebate
undebate copied to clipboard
catch and handle "firstName not allowed"
when user.js loads a record that has a unrecognized property in it, it through an error that is not handled, and processing is terminated. This happened when I tested something from a PR that added firstName and lastName, and generated a new record, and then went back to a different branch that didn't have the new fields.
It should catch the error, logger.error a message, and continue processing any way. We should do this in iota.js as well.
In models/user.js
@ddfridley, I spent time on the first step, to duplicate the issue. I ran into a kind of difficulty. It will be very helpful if you can give more detail about the following.
"This happened when I tested something from a PR that added firstName and lastName, and generated a new record, and then went back to a different branch that didn't have the new fields"
It will be great if you remember step by step. Once I can duplicate it, I believe the fix should be relatively straight forward.
@jzhou100 I added a branch mongo-not-allowed#167
you can do git checkout --track origin/mongo-not-allowed#167
to get it
you will see there's a new file app/models/test/user.js
you can run:
node node_modules/jest/bin/jest -t "user model tests"
and it will run the test. The two tests that fail, should pass after you implement this.
Note I'm not sure the test are catching the warning right so that part you will have to check on.
Change has been pushed. And it is ready for PR then Merge.
07/22: Task is completed. David will merge and close this task @ddfridley