summaryrefslogtreecommitdiff
path: root/guix/ui.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-10-10 10:22:43 +0200
committerLudovic Courtès <ludo@gnu.org>2017-10-10 23:12:03 +0200
commita6e22d84450450cacc6fc36445f6ae378a5b7ad0 (patch)
tree2e5043bed9e51706a51f95bcd6f7b23c2ba45ba5 /guix/ui.scm
parent3f81ca324b92fca653df26be112d866ea019e16a (diff)
downloadgnu-guix-a6e22d84450450cacc6fc36445f6ae378a5b7ad0.tar
gnu-guix-a6e22d84450450cacc6fc36445f6ae378a5b7ad0.tar.gz
ui: Improve reporting of missing closing parentheses.
Suggested by Ricardo Wurmus. Works around <https://bugs.gnu.org/28295>. * guix/ui.scm (report-load-error): Add case for 'read-error'. * tests/guix-system.sh: Test missing-closing-paren errors.
Diffstat (limited to 'guix/ui.scm')
-rw-r--r--guix/ui.scm9
1 files changed, 9 insertions, 0 deletions
diff --git a/guix/ui.scm b/guix/ui.scm
index 6dfc8c7a5b..3c8734a7d5 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -257,6 +257,15 @@ ARGS is the list of arguments received by the 'throw' handler."
(('system-error . rest)
(let ((err (system-error-errno args)))
(report-error (G_ "failed to load '~a': ~a~%") file (strerror err))))
+ (('read-error "scm_i_lreadparen" message _ ...)
+ ;; Guile's missing-paren messages are obscure so we make them more
+ ;; intelligible here.
+ (if (string-suffix? "end of file" message)
+ (let ((location (string-drop-right message
+ (string-length "end of file"))))
+ (format (current-error-port) (G_ "~amissing closing parenthesis~%")
+ location))
+ (apply throw args)))
(('syntax-error proc message properties form . rest)
(let ((loc (source-properties->location properties)))
(format (current-error-port) (G_ "~a: error: ~a~%")