[Persistence] Reliably return promises

This commit is contained in:
Victor Woeltjen 2016-07-26 15:30:40 -07:00
parent b60eff2f5e
commit 771542ee5f

View File

@ -89,7 +89,7 @@ define(
TransactionService.prototype.commit = function () { TransactionService.prototype.commit = function () {
var transaction = this.transaction; var transaction = this.transaction;
this.transaction = this.transactionStack.pop(); this.transaction = this.transactionStack.pop();
return transaction && transaction.commit(); return transaction ? transaction.commit() : Promise.reject();
}; };
/** /**
@ -103,7 +103,7 @@ define(
TransactionService.prototype.cancel = function () { TransactionService.prototype.cancel = function () {
var transaction = this.transaction; var transaction = this.transaction;
this.transaction = this.transactionStack.pop(); this.transaction = this.transactionStack.pop();
return transaction && transaction.cancel(); return transaction ? transaction.cancel() : Promise.reject();
}; };
TransactionService.prototype.size = function () { TransactionService.prototype.size = function () {