Make sure promise is returned

This commit is contained in:
Raymond Feng 2015-05-18 12:02:07 -07:00
parent 9031400838
commit 0e04f78637
1 changed files with 4 additions and 2 deletions

View File

@ -109,9 +109,10 @@ if (Transaction) {
cb = cb || utils.createPromiseCallback();
// Report an error if the transaction is not active
if (!self.connection) {
return process.nextTick(function() {
process.nextTick(function() {
cb(new Error('The transaction is not active: ' + self.id));
});
return cb.promise;
}
var context = {
transaction: self,
@ -142,9 +143,10 @@ if (Transaction) {
cb = cb || utils.createPromiseCallback();
// Report an error if the transaction is not active
if (!self.connection) {
return process.nextTick(function() {
process.nextTick(function() {
cb(new Error('The transaction is not active: ' + self.id));
});
return cb.promise;
}
var context = {
transaction: self,