不要怂,就是干,撸起袖子干!

Commit 01e8d333 by tornillo

Prevent Promise (bluebird) warnings

1 parent fac5fabf
......@@ -272,7 +272,7 @@ InstanceValidator.prototype._invokeBuiltinValidator = Promise.method(function(va
if (!validator[validatorType].apply(validator, [value].concat(validatorArgs))) {
// extract the error msg
throw test.msg || 'Validation ' + validatorType + ' failed';
throw new Error(test.msg || 'Validation ' + validatorType + ' failed');
}
});
......
......@@ -775,7 +775,7 @@ Sequelize.prototype.query = function(sql, options) {
}
if (options.transaction && options.transaction.finished) {
return Promise.reject(options.transaction.finished+' has been called on this transaction('+options.transaction.id+'), you can no longer use it');
return Promise.reject(new Error(options.transaction.finished+' has been called on this transaction('+options.transaction.id+'), you can no longer use it'));
}
if (this.test.$trackRunningQueries) {
......@@ -936,7 +936,7 @@ Sequelize.prototype.sync = function(options) {
if (options.match) {
if (!options.match.test(this.config.database)) {
return Promise.reject('Database does not match sync match parameter');
return Promise.reject(new Error('Database does not match sync match parameter'));
}
}
......@@ -1244,7 +1244,7 @@ Sequelize.prototype.transaction = function(options, autoCallback) {
if (transaction.finished) {
reject(err);
} else {
transaction.rollback().finally(function () {
return transaction.rollback().finally(function () {
reject(err);
});
}
......
......@@ -176,7 +176,7 @@ if (current.dialect.supports.transactions) {
var self = this;
return this.sequelize.transaction(function () {
var tid = self.ns.get('transaction').id;
return self.sequelize.Promise.reject('test rejection handler').then(null,function () {
return self.sequelize.Promise.reject(new Error('test rejection handler')).then(null,function () {
expect(self.ns.get('transaction').id).to.be.ok;
expect(self.ns.get('transaction').id).to.equal(tid);
});
......@@ -369,7 +369,7 @@ if (current.dialect.supports.transactions) {
return this.sequelize.transaction(function () {
var tid = self.ns.get('transaction').id;
return new Promise(function (resolve, reject) {
Promise.reject('test rejection handler').done(function () {
Promise.reject(new Error('test rejection handler')).done(function () {
reject(new Error('Should not have called first done handler'));
}, function (err) {
try {
......
......@@ -67,7 +67,7 @@ describe(Support.getTestDialectTeaser('Transaction'), function() {
var t;
return (expect(this.sequelize.transaction(function(transaction) {
t = transaction;
return Promise.reject('Swag');
return Promise.reject(new Error('Swag'));
})).to.eventually.be.rejected).then(function() {
expect(t.finished).to.be.equal('rollback');
});
......
......@@ -116,7 +116,7 @@ describe(Support.getTestDialectTeaser('Hooks'), function() {
this.Model.beforeCreate(function () {
this.hook1();
return Promise.reject('No!');
return Promise.reject(new Error('No!'));
}.bind(this));
this.Model.beforeCreate(this.hook2);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!