log errors occuring within sqlite transaction master
authorJustin Wind <justin.wind+git@gmail.com>
Tue, 1 Jul 2025 21:04:06 +0000 (14:04 -0700)
committerJustin Wind <justin.wind+git@gmail.com>
Tue, 1 Jul 2025 21:04:06 +0000 (14:04 -0700)
lib/sqlite-creator.js

index 1a85d236e10942a693b25a7abae27240183d1bd9..8eb5777453e97d992a469b3afef8ebebcc301a26 100644 (file)
@@ -311,6 +311,7 @@ INSERT INTO '${this.metaVersionTable}' (major, minor, patch) VALUES (0, 0, 0);`)
 
 
     async transaction(dbCtx, fn) {
+      const _scope = _fileScope('transaction');
       dbCtx = dbCtx || this.db;
 
       try {
@@ -318,6 +319,9 @@ INSERT INTO '${this.metaVersionTable}' (major, minor, patch) VALUES (0, 0, 0);`)
         const result = await fn(dbCtx);
         this.statement._commit.run();
         return result;
+      } catch (err) {
+        this.logger.error(_scope, 'failed in transaction', { error: err });
+        throw err;
       } finally {
         if (this.db.inTransaction) {
           this.statement._rollback.run();