mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-24 11:39:46 -05:00
ui: Gracefully report '&message' conditions.
* guix/ui.scm (report-load-error, warn-about-load-error) (read/eval): Add special-case for SRFI-35 &message conditions.
This commit is contained in:
parent
efe7d19a9e
commit
f816dba680
1 changed files with 16 additions and 4 deletions
20
guix/ui.scm
20
guix/ui.scm
|
@ -260,7 +260,11 @@ (define* (report-load-error file args #:optional frame)
|
|||
(format (current-error-port) (_ "~a: error: ~a~%")
|
||||
(location->string loc) message)))
|
||||
(('srfi-34 obj)
|
||||
(report-error (_ "exception thrown: ~s~%") obj))
|
||||
(if (message-condition? obj)
|
||||
(report-error (_ "~a~%")
|
||||
(gettext (condition-message obj)
|
||||
%gettext-domain))
|
||||
(report-error (_ "exception thrown: ~s~%") obj)))
|
||||
((error args ...)
|
||||
(report-error (_ "failed to load '~a':~%") file)
|
||||
(apply display-error frame (current-error-port) args))))
|
||||
|
@ -277,8 +281,12 @@ (define (warn-about-load-error file args) ;FIXME: factorize with ↑
|
|||
(format (current-error-port) (_ "~a: warning: ~a~%")
|
||||
(location->string loc) message)))
|
||||
(('srfi-34 obj)
|
||||
(warning (_ "failed to load '~a': exception thrown: ~s~%")
|
||||
file obj))
|
||||
(if (message-condition? obj)
|
||||
(warning (_ "failed to load '~a': ~a~%")
|
||||
file
|
||||
(gettext (condition-message obj) %gettext-domain))
|
||||
(warning (_ "failed to load '~a': exception thrown: ~s~%")
|
||||
file obj)))
|
||||
((error args ...)
|
||||
(warning (_ "failed to load '~a':~%") file)
|
||||
(apply display-error #f (current-error-port) args))))
|
||||
|
@ -539,7 +547,11 @@ (define (read/eval str)
|
|||
(('syntax-error proc message properties form . rest)
|
||||
(report-error (_ "syntax error: ~a~%") message))
|
||||
(('srfi-34 obj)
|
||||
(report-error (_ "exception thrown: ~s~%") obj))
|
||||
(if (message-condition? obj)
|
||||
(report-error (_ "~a~%")
|
||||
(gettext (condition-message obj)
|
||||
%gettext-domain))
|
||||
(report-error (_ "exception thrown: ~s~%") obj)))
|
||||
((error args ...)
|
||||
(apply display-error #f (current-error-port) args))
|
||||
(what? #f))
|
||||
|
|
Loading…
Reference in a new issue