From f4041120076f24ba61b69fcd1adf61a7ef4fd81f Mon Sep 17 00:00:00 2001 From: Josselin Poiret Date: Sat, 11 Jun 2022 18:59:38 +0200 Subject: channels: Print backtrace when generating package cache fails. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- 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 -- cgit v1.2.3