diff options
author | Ludovic Courtès <ludo@gnu.org> | 2020-01-24 10:13:10 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2020-01-24 23:56:42 +0100 |
commit | a07d5e558b5403dad0a59776b950b6b02169c249 (patch) | |
tree | cc07ff1c67e9dd358d1fafd418475ed98ee2900c | |
parent | 2aa1e76519199d800a334e7ef8883be34ea3dd62 (diff) | |
download | patches-a07d5e558b5403dad0a59776b950b6b02169c249.tar patches-a07d5e558b5403dad0a59776b950b6b02169c249.tar.gz |
ui: Do not display error messages with bare format strings.
On Guile 3, with, say, an error in ~/.guile, we'd get:
$ guix repl
guix repl: error: Unbound variable: ~S
* guix/ui.scm (call-with-error-handling): Add
'&exception-with-kind-and-args' case.
-rw-r--r-- | guix/ui.scm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/guix/ui.scm b/guix/ui.scm index 4857a88827..a47dafecd4 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -770,6 +770,17 @@ directories:~{ ~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' come are + ;; compound and include a '&message'. However, that message only + ;; contains the format string. Thus, special-case it here to + ;; avoid displaying a bare format string. + ((cond-expand + (guile-3 + ((exception-predicate &exception-with-kind-and-args) c)) + (else #f)) + (raise c)) + ((message-condition? c) ;; Normally '&message' error conditions have an i18n'd message. (leave (G_ "~a~%") |