Disallow transaction to return a Promise due to unexpected behaviour

Co-authored-by: phiresky <[email protected]>
This commit is contained in:
Mahesh Bandara Wijerathna
2025-05-15 16:38:58 +05:30
co-authored by phiresky
parent 29c1abe314
commit ef5d89295c
+3
View File
@@ -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) {