ui: Add 'display-hint'.
* guix/ui.scm (known-variable-definition): New procedure. (report-load-error): Use it.
This commit is contained in:
parent
d8f075c3a3
commit
935542fbde
11
guix/ui.scm
11
guix/ui.scm
|
@ -229,6 +229,13 @@ messages."
|
||||||
(else
|
(else
|
||||||
#t))))))
|
#t))))))
|
||||||
|
|
||||||
|
(define* (display-hint message #:optional (port (current-error-port)))
|
||||||
|
"Display MESSAGE, a l10n message possibly containing Texinfo markup, to
|
||||||
|
PORT."
|
||||||
|
(format port (G_ "hint: ~a~%")
|
||||||
|
(fill-paragraph (texi->plain-text message)
|
||||||
|
(terminal-columns) 8)))
|
||||||
|
|
||||||
(define* (report-load-error file args #:optional frame)
|
(define* (report-load-error file args #:optional frame)
|
||||||
"Report the failure to load FILE, a user-provided Scheme file.
|
"Report the failure to load FILE, a user-provided Scheme file.
|
||||||
ARGS is the list of arguments received by the 'throw' handler."
|
ARGS is the list of arguments received by the 'throw' handler."
|
||||||
|
@ -262,9 +269,7 @@ ARGS is the list of arguments received by the 'throw' handler."
|
||||||
%gettext-domain)))
|
%gettext-domain)))
|
||||||
(report-error (G_ "exception thrown: ~s~%") obj))
|
(report-error (G_ "exception thrown: ~s~%") obj))
|
||||||
(when (fix-hint? obj)
|
(when (fix-hint? obj)
|
||||||
(format (current-error-port) (G_ "hint: ~a~%")
|
(display-hint (condition-fix-hint obj))))
|
||||||
(fill-paragraph (texi->plain-text (condition-fix-hint obj))
|
|
||||||
(terminal-columns) 8))))
|
|
||||||
((error args ...)
|
((error args ...)
|
||||||
(report-error (G_ "failed to load '~a':~%") file)
|
(report-error (G_ "failed to load '~a':~%") file)
|
||||||
(apply display-error frame (current-error-port) args))))
|
(apply display-error frame (current-error-port) args))))
|
||||||
|
|
Loading…
Reference in New Issue