guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/02: ui: Improve error reporting for 'read/eval'.


From: Ludovic Courtès
Subject: 01/02: ui: Improve error reporting for 'read/eval'.
Date: Tue, 26 May 2015 21:46:10 +0000

civodul pushed a commit to branch master
in repository guix.

commit 41766807d042023b1f807cc40e9fd09fc3682a4e
Author: Ludovic Courtès <address@hidden>
Date:   Tue May 26 22:38:17 2015 +0200

    ui: Improve error reporting for 'read/eval'.
    
    The effect is visible on commands like:
    
      guix build -e '(+ 2 "foo")'
      guix build -e '()'
    
    * guix/ui.scm (read/eval): Change handler to properly report syntax errors 
and
      use 'display-error' for other errors.
---
 guix/ui.scm |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/guix/ui.scm b/guix/ui.scm
index 7490de0..2140c2e 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -446,8 +446,14 @@ interpreted."
       (lambda ()
         (eval exp (force %guix-user-module)))
       (lambda args
-        (leave (_ "failed to evaluate expression `~a': ~s~%")
-               exp args)))))
+        (report-error (_ "failed to evaluate expression '~a':~%") exp)
+        (match args
+          (('syntax-error proc message properties form . rest)
+           (report-error (_ "syntax error: ~a~%") message))
+          ((error args ...)
+           (apply display-error #f (current-error-port) args))
+          (what? #f))
+        (exit 1)))))
 
 (define (read/eval-package-expression str)
   "Read and evaluate STR and return the package it refers to, or exit an



reply via email to

[Prev in Thread] Current Thread [Next in Thread]