fx-compat: Throw error if generator is passed to DB.executeTransaction()

This commit is contained in:
Dan Stillman 2020-07-05 06:21:40 -04:00
parent 03242e8984
commit 993320655e

View file

@ -466,6 +466,12 @@ Zotero.DBConnection.prototype.executeTransaction = async function (func, options
}
var conn = this._getConnection(options) || (await this._getConnectionAsync(options));
if (func.constructor.name == 'GeneratorFunction') {
throw new Error("Zotero.DB.executeTransaction() no longer takes a generator function "
+ "-- pass an async function instead");
}
var result = await conn.executeTransaction(func);
Zotero.debug(`Committed DB transaction ${id}`, 4);