mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
ui: Factorize '&message' handling.
* guix/ui.scm (call-with-error-handling): Factorize the three 'message-condition?' clauses into one.
This commit is contained in:
parent
7a0bf3d533
commit
efe037fc5c
1 changed files with 5 additions and 13 deletions
18
guix/ui.scm
18
guix/ui.scm
|
@ -782,17 +782,14 @@ (define (manifest-entry-output* entry)
|
||||||
(invoke-error-stop-signal c)
|
(invoke-error-stop-signal c)
|
||||||
(cons (invoke-error-program c)
|
(cons (invoke-error-program c)
|
||||||
(invoke-error-arguments c))))
|
(invoke-error-arguments c))))
|
||||||
((and (error-location? c) (message-condition? c))
|
((message-condition? c)
|
||||||
(report-error (error-location c) (G_ "~a~%")
|
;; 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))
|
(gettext (condition-message c) %gettext-domain))
|
||||||
(when (fix-hint? c)
|
(when (fix-hint? c)
|
||||||
(display-hint (condition-fix-hint c)))
|
(display-hint (condition-fix-hint c)))
|
||||||
(exit 1))
|
(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
|
;; On Guile 3.0.0, exceptions such as 'unbound-variable' are
|
||||||
;; compound and include a '&message'. However, that message only
|
;; compound and include a '&message'. However, that message only
|
||||||
|
@ -806,12 +803,7 @@ (define (manifest-entry-output* entry)
|
||||||
(guile-3
|
(guile-3
|
||||||
((exception-predicate &exception-with-kind-and-args) c))
|
((exception-predicate &exception-with-kind-and-args) c))
|
||||||
(else #f))
|
(else #f))
|
||||||
(raise c))
|
(raise c)))
|
||||||
|
|
||||||
((message-condition? c)
|
|
||||||
;; Normally '&message' error conditions have an i18n'd message.
|
|
||||||
(leave (G_ "~a~%")
|
|
||||||
(gettext (condition-message c) %gettext-domain))))
|
|
||||||
;; Catch EPIPE and the likes.
|
;; Catch EPIPE and the likes.
|
||||||
(catch 'system-error
|
(catch 'system-error
|
||||||
thunk
|
thunk
|
||||||
|
|
Loading…
Reference in a new issue