projects
/
squeep-db-helper
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7320d3b
)
log errors occuring within sqlite transaction
master
author
Justin Wind
<justin.wind+git@gmail.com>
Tue, 1 Jul 2025 21:04:06 +0000
(14:04 -0700)
committer
Justin Wind
<justin.wind+git@gmail.com>
Tue, 1 Jul 2025 21:04:06 +0000
(14:04 -0700)
lib/sqlite-creator.js
patch
|
blob
|
history
diff --git
a/lib/sqlite-creator.js
b/lib/sqlite-creator.js
index 1a85d236e10942a693b25a7abae27240183d1bd9..8eb5777453e97d992a469b3afef8ebebcc301a26 100644
(file)
--- a/
lib/sqlite-creator.js
+++ b/
lib/sqlite-creator.js
@@
-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();