Reputation: 1066
When any of my Sequelize validations are triggered I receive a non-error
warning in the console. Here is an example of one field's validations:
company_name: {
type: Sequelize.STRING(100),
allowNull: true,
validate: {
not: {args: [badWordsList.regex], msg: "Try to keep the profanity to a minimum."},
len: {args: [0, 100], msg: "Your company name cannot be greater than 100 characters long."}
}
}
The warning is a stack trace and looks like:
Warning: a promise was rejected with a non-error: [object String]
at /Users/<user>/Documents/Webstorm Projects/<project>/node_modules/sequelize/lib/instance-validator.js:193:33
at /Users/<user>/Documents/Webstorm Projects/<project>/node_modules/lodash/index.js:3073:15
...
I have tried updating and upgrading npm but have not had any luck resolving these warnings. Everything works fine otherwise. Is there any way to either prevent or suppress these warnings? I will include more of the stack trace if need be. Thanks!
Upvotes: 2
Views: 839
Reputation: 1035
If you check the code of instance-validator.js
, it seems that it throws the msg
as an error:
https://github.com/sequelize/sequelize/blob/master/lib/instance-validator.js#L275
sequelize
uses Bluebird
promise library, and it shows the warning at the end:
You can ignore the warning.
Upvotes: 2