undebate icon indicating copy to clipboard operation
undebate copied to clipboard

catch and handle "firstName not allowed"

Open ddfridley opened this issue 4 years ago • 5 comments

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.

ddfridley avatar May 05 '20 23:05 ddfridley

In models/user.js

ddfridley avatar May 17 '20 16:05 ddfridley

@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 avatar May 24 '20 17:05 jzhou100

@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.

ddfridley avatar May 26 '20 05:05 ddfridley

Change has been pushed. And it is ready for PR then Merge.

jzhou100 avatar May 31 '20 18:05 jzhou100

07/22: Task is completed. David will merge and close this task @ddfridley

poornaraob avatar Jul 23 '20 02:07 poornaraob