MCPcopy
hub / github.com/sequelize/sequelize / rollback

Method rollback

lib/transaction.js:75–92  ·  lib/transaction.js::Transaction.rollback

* Rollback (abort) the transaction * * @returns {Promise}

()

Source from the content-addressed store, hash-verified

73 * @returns {Promise}
74 */
75 async rollback() {
76 if (this.finished) {
77 throw new Error(`Transaction cannot be rolled back because it has been finished with state: ${this.finished}`);
78 }
79
80 if (!this.connection) {
81 throw new Error(class="st">'Transaction cannot be rolled back because it never started');
82 }
83
84 try {
85 return await this
86 .sequelize
87 .getQueryInterface()
88 .rollbackTransaction(this, this.options);
89 } finally {
90 this.cleanup();
91 }
92 }
93
94 /**
95 * Called to acquire a connection to use and set the correct options on the connection.

Callers 15

transactionMethod · 0.95
prepareEnvironmentMethod · 0.95
transactFunction · 0.80
runMethod · 0.80
runMethod · 0.80
runMethod · 0.80
cls.test.jsFile · 0.80
model.test.jsFile · 0.80
testAsyncFunction · 0.80
sequelize.test.jsFile · 0.80

Calls 3

cleanupMethod · 0.95
rollbackTransactionMethod · 0.80
getQueryInterfaceMethod · 0.80

Tested by 1

testAsyncFunction · 0.64