summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2024-04-21 10:42:34 +0100
committerGuix Patches Tester <>2024-04-21 11:53:20 +0200
commit366eb99573b2f182f0fed2d33136ccff5fb90454 (patch)
tree4f6ede86d198044a9c839fdaca69c23619821a42
parentc261786ee1c1acd54c8351e32a7cb890924dd7d6 (diff)
downloadguix-patches-366eb99573b2f182f0fed2d33136ccff5fb90454.tar
guix-patches-366eb99573b2f182f0fed2d33136ccff5fb90454.tar.gz
store: database: Log when aborting transactions.
Otherwise this has the effect of masking the backtrace/exception. * guix/store/database.scm (call-with-transaction): Log when aborting. Change-Id: Iee31905c4688dc62ef37a85b0208fd324ee67d70
-rw-r--r--guix/store/database.scm14
1 files changed, 11 insertions, 3 deletions
diff --git a/guix/store/database.scm b/guix/store/database.scm
index 8a3436368e..b6f87d710f 100644
--- a/guix/store/database.scm
+++ b/guix/store/database.scm
@@ -154,9 +154,17 @@ times. This may reduce contention for the database somewhat."
(sqlite-exec db (if restartable? "begin;" "begin immediate;"))
(catch #t
(lambda ()
- (let-values ((result (proc)))
- (sqlite-exec db "commit;")
- (apply values result)))
+ (with-throw-handler #t
+ (lambda ()
+ (call-with-values proc
+ (lambda vals
+ (sqlite-exec db "commit;")
+ (apply values vals))))
+ (lambda (key args)
+ (simple-format
+ (current-error-port)
+ "transaction aborted: ~A: ~A\n" key args)
+ (backtrace))))
(lambda args
;; The roll back may or may not have occurred automatically when the
;; error was generated. If it has occurred, this does nothing but signal