guix-commits
[Top][All Lists]
Advanced

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

03/06: ui: Always print the exception upon load errors.


From: guix-commits
Subject: 03/06: ui: Always print the exception upon load errors.
Date: Mon, 11 Feb 2019 17:26:17 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit 70a50305c495ca96fdec3d31e7e7972cfc54f8ee
Author: Ludovic Courtès <address@hidden>
Date:   Mon Feb 11 22:48:24 2019 +0100

    ui: Always print the exception upon load errors.
    
    Fixes <https://bugs.gnu.org/34402>.
    Reported by <address@hidden>.
    
    Previously 'display-error' could be called with the wrong number of
    arguments (e.g., for 'git-error' exceptions), and thus nothing at all
    was displayed.
    
    * guix/ui.scm (report-load-error): Check whether ARGS matches the
    parameters for 'display-error' and call 'print-exception' otherwise.
---
 guix/ui.scm | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/guix/ui.scm b/guix/ui.scm
index f046551..2fc001d 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -374,9 +374,16 @@ ARGS is the list of arguments received by the 'throw' 
handler."
          (report-error (G_ "exception thrown: ~s~%") obj))
      (when (fix-hint? obj)
        (display-hint (condition-fix-hint obj))))
-    ((error args ...)
+    ((key args ...)
      (report-error (G_ "failed to load '~a':~%") file)
-     (apply display-error frame (current-error-port) args))))
+     (match args
+       (((? symbol? proc) (? string? message) (args ...) . rest)
+        (display-error frame (current-error-port) proc message
+                       args rest))
+       (_
+        ;; Some exceptions like 'git-error' do not follow Guile's convention
+        ;; above and need to be printed with 'print-exception'.
+        (print-exception (current-error-port) frame key args))))))
 
 (define (warn-about-load-error file args)         ;FIXME: factorize with ↑
   "Report the failure to load FILE, a user-provided Scheme file, without



reply via email to

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