mirror of
https://github.com/hanzoai/better-sqlite3-multiple-ciphers.git
synced 2026-09-24 16:57:19 +00:00
Disallow transaction to return a Promise due to unexpected behaviour
Co-authored-by: phiresky <[email protected]>
This commit is contained in:
co-authored by
phiresky
parent
29c1abe314
commit
ef5d89295c
@@ -63,6 +63,9 @@ const wrapTransaction = (apply, fn, db, { begin, commit, rollback, savepoint, re
|
||||
before.run();
|
||||
try {
|
||||
const result = apply.call(fn, this, arguments);
|
||||
if (result && typeof result.then === 'function') {
|
||||
throw new TypeError('Transaction function cannot return a promise');
|
||||
}
|
||||
after.run();
|
||||
return result;
|
||||
} catch (ex) {
|
||||
|
||||
Reference in New Issue
Block a user