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(errors): spurious Bluebird warnings #8408
Conversation
The way Sequelize instantiates some of its Error subclasses confuses Bluebird into thinking that Promises are rejected with non-Error objects. See petkaantonov/bluebird#990
@@ -11,7 +11,6 @@ class BaseError extends Error { | |||
constructor(message) { | |||
super(message); | |||
this.name = 'SequelizeBaseError'; | |||
this.message = message; |
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.
The super class should already set this.message = message
. The only slight API change is if clients relied on Sequelize's behavior of not defaulting message
to ''
, which Error does.
Note that Sequelize wasn't totally consistent in this regard, since ValidationErrorItem.message
defaulted to ''
.
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.
ECMAScript specs says error messages should default to empty string where we are setting them to undefined
.
Bluebird's error check also conforms to this, but it would be better if they also include instance of
check as undefined error message very much is possible in everyday code.
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.
LGTM
Pull Request check-list
npm run test
ornpm run test-DIALECT
pass with this change (including linting)?Description of change
The way Sequelize instantiates some of its Error subclasses confuses Bluebird into thinking that Promises are rejected with non-Error objects, so you get warnings when running with
BLUEBIRD_DEBUG
enabled.See petkaantonov/bluebird#990