guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/05: channels: Print backtrace when generating package cache fails.


From: guix-commits
Subject: 02/05: channels: Print backtrace when generating package cache fails.
Date: Thu, 16 Jun 2022 07:34:17 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit f4041120076f24ba61b69fcd1adf61a7ef4fd81f
Author: Josselin Poiret <dev@jpoiret.xyz>
AuthorDate: Sat Jun 11 18:59:38 2022 +0200

    channels: Print backtrace when generating package cache fails.
    
    * guix/channels.scm (package-cache-file): Add a throw handler around
    the generate-package-cache call, and print backtrace in it.
    
    Signed-off-by: Ludovic Courtès <ludo@gnu.org>
---
 guix/channels.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/guix/channels.scm b/guix/channels.scm
index 5f47834c10..ce1a60436f 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -907,7 +907,14 @@ be used as a profile hook."
                 (format (current-error-port)
                         "Generating package cache for '~a'...~%"
                         #$profile)
-                (generate-package-cache #$output))
+                ;; This script runs through (primitive-load), which by default
+                ;; doesn't print backtraces when it encounters an exception,
+                ;; so manually do it.  Use with-throw-handler because it is
+                ;; supported by all Guile versions.
+                (with-throw-handler #t
+                  (lambda () (generate-package-cache #$output))
+                  (lambda (key . args)
+                      (backtrace))))
               (mkdir #$output))))
 
     (gexp->derivation-in-inferior "guix-package-cache" build



reply via email to

[Prev in Thread] Current Thread [Next in Thread]