mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 05:18:07 -05:00
ui: Add an 'unbound-variable' exception printer.
* guix/ui.scm (print-unbound-variable-error): New variable. Use it as the 'unbound-variable' printer.
This commit is contained in:
parent
a2985bb101
commit
dc856223f5
1 changed files with 12 additions and 0 deletions
12
guix/ui.scm
12
guix/ui.scm
|
@ -149,6 +149,18 @@ (define-syntax-rule (leave args ...)
|
|||
(report-error args ...)
|
||||
(exit 1)))
|
||||
|
||||
(define (print-unbound-variable-error port key args default-printer)
|
||||
;; Print unbound variable errors more nicely, and in the right language.
|
||||
(match args
|
||||
((proc message (variable) _ ...)
|
||||
;; We can always omit PROC because when it's useful (i.e., different from
|
||||
;; "module-lookup"), it gets displayed before.
|
||||
(format port (G_ "~a: unbound variable") variable))
|
||||
(_
|
||||
(default-printer))))
|
||||
|
||||
(set-exception-printer! 'unbound-variable print-unbound-variable-error)
|
||||
|
||||
(define (make-user-module modules)
|
||||
"Return a new user module with the additional MODULES loaded."
|
||||
;; Module in which the machine description file is loaded.
|
||||
|
|
Loading…
Reference in a new issue