Update exception handling in load-new-guix-revision

This commit is contained in:
Christopher Baines 2025-02-03 22:38:27 +00:00
parent 931b7bc593
commit 3646de6097

View file

@ -1332,13 +1332,14 @@ SELECT 1 FROM derivation_source_file_nars WHERE derivation_source_file_id = $1"
(lambda (exn) (lambda (exn)
(put-message channel `(exception . ,exn))) (put-message channel `(exception . ,exn)))
(lambda () (lambda ()
(with-throw-handler #t (with-exception-handler
(lambda (exn)
(print-backtrace-and-exception/knots exn)
(raise-exception exn))
(lambda () (lambda ()
(call-with-values thunk (call-with-values thunk
(lambda values (lambda values
(put-message channel `(values ,@values))))) (put-message channel `(values ,@values)))))))
(lambda _
(backtrace))))
#:unwind? #t)))) #:unwind? #t))))
(match (get-message channel) (match (get-message channel)
@ -1528,18 +1529,20 @@ SELECT 1 FROM derivation_source_file_nars WHERE derivation_source_file_id = $1"
(cons system #f)) (cons system #f))
(raise-exception exn))) (raise-exception exn)))
(lambda () (lambda ()
(with-throw-handler #t (with-exception-handler
(lambda (exn)
(simple-format
(current-error-port)
"failed to compute channel instance derivation for ~A\n"
system)
(print-backtrace-and-exception/knots exn)
(raise-exception exn))
(lambda () (lambda ()
(cons system (cons system
(inferior-eval-with-store/non-blocking (inferior-eval-with-store/non-blocking
inferior inferior
inferior-store inferior-store
(inferior-code channel-instance system)))) (inferior-code channel-instance system))))))
(lambda _
(simple-format
(current-error-port)
"failed to compute channel instance derivation for ~A\n"
system))))
#:unwind? #t))))) #:unwind? #t)))))
systems))) systems)))
@ -1697,11 +1700,11 @@ SELECT 1 FROM derivation_source_file_nars WHERE derivation_source_file_id = $1"
;; Normalise the locale for the inferior process ;; Normalise the locale for the inferior process
(with-exception-handler (with-exception-handler
(lambda (key . args) (lambda (exn)
(simple-format (simple-format
(current-error-port) (current-error-port)
"warning: failed to set locale to en_US.UTF-8: ~A ~A\n" "warning: failed to set locale to en_US.UTF-8: ~A\n"
key args)) exn))
(lambda () (lambda ()
(inferior-eval '(setlocale LC_ALL "en_US.UTF-8") inf))) (inferior-eval '(setlocale LC_ALL "en_US.UTF-8") inf)))
@ -2896,7 +2899,13 @@ SKIP LOCKED")
(with-exception-handler (with-exception-handler
(const #f) (const #f)
(lambda () (lambda ()
(with-throw-handler #t (with-exception-handler
(lambda (exn)
(simple-format (current-error-port)
"error: load-new-guix-revision: ~A\n"
exn)
(print-backtrace-and-exception/knots exn)
(raise-exception exn))
(lambda () (lambda ()
(load-new-guix-revision (load-new-guix-revision
conn conn
@ -2907,12 +2916,7 @@ SKIP LOCKED")
extra-inferior-environment-variables extra-inferior-environment-variables
#:ignore-systems ignore-systems #:ignore-systems ignore-systems
#:ignore-targets ignore-targets #:ignore-targets ignore-targets
#:parallelism parallelism)) #:parallelism parallelism))))
(lambda (key . args)
(simple-format (current-error-port)
"error: load-new-guix-revision: ~A ~A\n"
key args)
(backtrace))))
#:unwind? #t)) #:unwind? #t))
#t) #t)
(begin (begin