aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2025-04-01 22:56:34 +0300
committerChristopher Baines <mail@cbaines.net>2025-04-01 22:56:34 +0300
commit97a01853b8e2bc2329e82dea8da920048c095d14 (patch)
tree13ec9740d9350560b47db520fd7fad0e33ecec48
parent14de1667b16a4732b6548b6580983b122f1c9cb9 (diff)
downloaddata-service-97a01853b8e2bc2329e82dea8da920048c095d14.tar
data-service-97a01853b8e2bc2329e82dea8da920048c095d14.tar.gz
Unwind the stack when handling transaction errors
As this avoids trying to suspend while the stack is in a unpredictable state.
-rw-r--r--guix-data-service/database.scm4
1 files changed, 3 insertions, 1 deletions
diff --git a/guix-data-service/database.scm b/guix-data-service/database.scm
index 26e40a0..86747e0 100644
--- a/guix-data-service/database.scm
+++ b/guix-data-service/database.scm
@@ -216,13 +216,15 @@
(lambda ()
(exec-query conn "ROLLBACK;"))
#:unwind? #t)
+ ;; TODO Include the stack in the exception via knots
(raise-exception exn))
(lambda ()
(let ((result (f conn)))
(exec-query conn (if always-rollback?
"ROLLBACK;"
"COMMIT;"))
- result))))
+ result))
+ #:unwind? #t))
(define (check-test-database! conn)
(match (exec-query conn "SELECT current_database()")