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

Commit 5bc2d11c by Mick Hansen

remove transaction deprecation notice and check for thenable on return

1 parent b621950a
Showing with 1 additions and 3 deletions
...@@ -1114,8 +1114,6 @@ module.exports = (function() { ...@@ -1114,8 +1114,6 @@ module.exports = (function() {
, ns = Sequelize.cls; , ns = Sequelize.cls;
if (autoCallback) { if (autoCallback) {
deprecated('Note: When passing a callback to a transaction a promise chain is expected in return, the transaction will be committed or rejected based on the promise chain returned to the callback.');
var transactionResolver = function (resolve, reject) { var transactionResolver = function (resolve, reject) {
transaction.prepareEnvironment().then(function () { transaction.prepareEnvironment().then(function () {
if (ns) { if (ns) {
...@@ -1123,7 +1121,7 @@ module.exports = (function() { ...@@ -1123,7 +1121,7 @@ module.exports = (function() {
} }
var result = autoCallback(transaction); var result = autoCallback(transaction);
if (!result) return reject(new Error('You need to return a promise chain to the sequelize.transaction() callback')); if (!result || !result.then) return reject(new Error('You need to return a promise chain/thenable to the sequelize.transaction() callback'));
result.then(function (result) { result.then(function (result) {
return transaction.commit().then(function () { return transaction.commit().then(function () {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!