summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-07-25 15:50:36 +0200
committerLudovic Courtès <ludo@gnu.org>2020-07-25 19:11:36 +0200
commitefe037fc5cc3134bbc3ef4e36b49a3f788921b68 (patch)
treeb6d5916e0516e5a988329f37e57e0e5f0f03393a
parent7a0bf3d5337d2662b0e4cdb8c9f8b5162c401d23 (diff)
downloadguix-efe037fc5cc3134bbc3ef4e36b49a3f788921b68.tar.gz
ui: Factorize '&message' handling.
* guix/ui.scm (call-with-error-handling): Factorize the three
'message-condition?' clauses into one.
-rw-r--r--guix/ui.scm18
1 files changed, 5 insertions, 13 deletions
diff --git a/guix/ui.scm b/guix/ui.scm
index 27bcade9dd..588eb8480e 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -782,17 +782,14 @@ directories:~{ ~a~}~%")
                      (invoke-error-stop-signal c)
                      (cons (invoke-error-program c)
                            (invoke-error-arguments c))))
-             ((and (error-location? c) (message-condition? c))
-              (report-error (error-location c) (G_ "~a~%")
+             ((message-condition? c)
+              ;; Normally '&message' error conditions have an i18n'd message.
+              (report-error (and (error-location? c) (error-location c))
+                            (G_ "~a~%")
                             (gettext (condition-message c) %gettext-domain))
               (when (fix-hint? c)
                 (display-hint (condition-fix-hint c)))
               (exit 1))
-             ((and (message-condition? c) (fix-hint? c))
-              (report-error (G_ "~a~%")
-                            (gettext (condition-message c) %gettext-domain))
-              (display-hint (condition-fix-hint c))
-              (exit 1))
 
              ;; On Guile 3.0.0, exceptions such as 'unbound-variable' are
              ;; compound and include a '&message'.  However, that message only
@@ -806,12 +803,7 @@ directories:~{ ~a~}~%")
                 (guile-3
                  ((exception-predicate &exception-with-kind-and-args) c))
                 (else #f))
-              (raise c))
-
-             ((message-condition? c)
-              ;; Normally '&message' error conditions have an i18n'd message.
-              (leave (G_ "~a~%")
-                     (gettext (condition-message c) %gettext-domain))))
+              (raise c)))
       ;; Catch EPIPE and the likes.
       (catch 'system-error
         thunk