pqb 0.41.3 → 0.41.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3406,20 +3406,18 @@ class Transaction {
3406
3406
  sql.text = `BEGIN${options.level ? ` ISOLATION LEVEL ${options.level}` : ""}${options.readOnly !== void 0 ? ` READ ${options.readOnly ? "ONLY" : "WRITE"}` : ""}${options.deferrable !== void 0 ? ` ${options.deferrable ? "" : "NOT "}DEFERRABLE` : ""}`;
3407
3407
  if (log)
3408
3408
  logData = log.beforeQuery(sql);
3409
- try {
3410
- const result = await this.q.adapter.transaction(sql, callback);
3411
- if (log)
3412
- log.afterQuery(commitSql$1, logData);
3413
- await runAfterCommit(
3414
- trx.afterCommit,
3415
- result
3416
- );
3417
- return result;
3418
- } catch (err) {
3409
+ const result = await this.q.adapter.transaction(sql, callback).catch((err) => {
3419
3410
  if (log)
3420
3411
  log.afterQuery(rollbackSql$1, logData);
3421
3412
  throw err;
3422
- }
3413
+ });
3414
+ if (log)
3415
+ log.afterQuery(commitSql$1, logData);
3416
+ await runAfterCommit(
3417
+ trx.afterCommit,
3418
+ result
3419
+ );
3420
+ return result;
3423
3421
  } else {
3424
3422
  try {
3425
3423
  sql.text = `SAVEPOINT "${transactionId}"`;