[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#70494] [PATCH 16/23] store: database: Log when aborting transaction
From: |
Christopher Baines |
Subject: |
[bug#70494] [PATCH 16/23] store: database: Log when aborting transactions. |
Date: |
Sun, 21 Apr 2024 10:42:34 +0100 |
Otherwise this has the effect of masking the backtrace/exception.
* guix/store/database.scm (call-with-transaction): Log when aborting.
Change-Id: Iee31905c4688dc62ef37a85b0208fd324ee67d70
---
guix/store/database.scm | 14 +++++++++++---
1 file 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 @@ (define* (call-with-transaction db proc #:key restartable?)
(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
--
2.41.0
- [bug#70494] [PATCH 00/23] Groundwork for the Guile guix-daemon, Christopher Baines, 2024/04/21
- [bug#70494] [PATCH 03/23] syscalls: Add missing pieces for derivation build environment., Christopher Baines, 2024/04/21
- [bug#70494] [PATCH 02/23] gnu: linux-container: Make it more suitable for derivation-building., Christopher Baines, 2024/04/21
- [bug#70494] [PATCH 07/23] serialization: Export read-byte-string., Christopher Baines, 2024/04/21
- [bug#70494] [PATCH 05/23] store: build-derivations: New module., Christopher Baines, 2024/04/21
- [bug#70494] [PATCH 16/23] store: database: Log when aborting transactions.,
Christopher Baines <=
- [bug#70494] [PATCH 17/23] store: database: Export transaction helpers., Christopher Baines, 2024/04/21
- [bug#70494] [PATCH 04/23] guix: store: environment: New module., Christopher Baines, 2024/04/21
- [bug#70494] [PATCH 18/23] guix: http-client: Add network-error?., Christopher Baines, 2024/04/21
- [bug#70494] [PATCH 19/23] http-client: Include EPIPE in network-error?., Christopher Baines, 2024/04/21
- [bug#70494] [PATCH 20/23] scripts: substitute: Simplify with-timeout usage., Christopher Baines, 2024/04/21
- [bug#70494] [PATCH 01/23] store: database: Register derivation outputs., Christopher Baines, 2024/04/21
- [bug#70494] [PATCH 21/23] scripts: substitute: Don't enforce cached connections in download-nar., Christopher Baines, 2024/04/21
- [bug#70494] [PATCH 08/23] store: Add text-output-path and text-output-path-from-hash., Christopher Baines, 2024/04/21
- [bug#70494] [PATCH 09/23] store: Add validate-store-name., Christopher Baines, 2024/04/21
- [bug#70494] [PATCH 13/23] syscalls: Add unshare., Christopher Baines, 2024/04/21