summaryrefslogtreecommitdiff
path: root/guix/ui.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-05-26 23:06:13 +0200
committerLudovic Courtès <ludo@gnu.org>2021-06-01 23:26:07 +0200
commit5bcb4f8a58ad316174768c167927c03be3272786 (patch)
tree45c63a5b2fec99a3aa811ff2584ad738fb6b465a /guix/ui.scm
parent82d8ab01f5cb6d479e3b82c08067e2442ee7cad8 (diff)
downloadguix-patches-5bcb4f8a58ad316174768c167927c03be3272786.tar
guix-patches-5bcb4f8a58ad316174768c167927c03be3272786.tar.gz
ui, lint: Simplify exception handling in Guile 3 style.
* guix/lint.scm (check-derivation)[try]: Remove "catch #t" wrapping. * guix/ui.scm (call-with-error-handling): Remove "catch 'system-error" and move 'system-error handling to the &exception-with-kind-and-args clause.
Diffstat (limited to 'guix/ui.scm')
-rw-r--r--guix/ui.scm14
1 files changed, 7 insertions, 7 deletions
diff --git a/guix/ui.scm b/guix/ui.scm
index 6b0155f563..d3e01f846d 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -812,7 +812,12 @@ directories:~{ ~a~}~%")
;; been unwound when we re-raise, since that would otherwise show
;; useless backtraces.
(((exception-predicate &exception-with-kind-and-args) c)
- (raise c))
+ (if (eq? 'system-error (exception-kind c)) ;EPIPE & co.
+ (match (exception-args c)
+ ((proc format-string format-args . _)
+ (leave (G_ "~a: ~a~%") proc
+ (apply format #f format-string format-args))))
+ (raise c)))
((message-condition? c)
;; Normally '&message' error conditions have an i18n'd message.
@@ -822,12 +827,7 @@ directories:~{ ~a~}~%")
(when (fix-hint? c)
(display-hint (condition-fix-hint c)))
(exit 1)))
- ;; Catch EPIPE and the likes.
- (catch 'system-error
- thunk
- (lambda (key proc format-string format-args . rest)
- (leave (G_ "~a: ~a~%") proc
- (apply format #f format-string format-args))))))
+ (thunk)))
(define-syntax-rule (leave-on-EPIPE exp ...)
"Run EXP... in a context where EPIPE errors are caught and lead to 'exit'