aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-01-22 22:43:46 +0100
committerLudovic Courtès <ludo@gnu.org>2015-01-22 22:43:46 +0100
commit70e629f5483bd3a5bf9c27e9f401d7d933dc222d (patch)
treed3756e410a891ea75b0e1beea50ff1ab17cad904
parentfbb020451ea25896936a5fba966612b59c0bcdf3 (diff)
downloadguix-70e629f5483bd3a5bf9c27e9f401d7d933dc222d.tar
guix-70e629f5483bd3a5bf9c27e9f401d7d933dc222d.tar.gz
guix system: Improve error messages.
* guix/ui.scm (report-error): Export. * guix/scripts/system.scm (read-operating-system): Report syntax errors using standard GNU format. Report other errors using 'display-error'.
-rw-r--r--guix/scripts/system.scm13
-rw-r--r--guix/ui.scm1
2 files changed, 9 insertions, 5 deletions
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index b0974dcfcd..3eea872fe8 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -76,11 +76,14 @@
file (strerror err))))
(('syntax-error proc message properties form . rest)
(let ((loc (source-properties->location properties)))
- (leave (_ "~a: ~a~%")
- (location->string loc) message)))
- (_
- (leave (_ "failed to load operating system file '~a': ~s~%")
- file args))))))
+ (format (current-error-port) (_ "~a: error: ~a~%")
+ (location->string loc) message)
+ (exit 1)))
+ ((error args ...)
+ (report-error (_ "failed to load operating system file '~a':~%")
+ file)
+ (apply display-error #f (current-error-port) args)
+ (exit 1))))))
;;;
diff --git a/guix/ui.scm b/guix/ui.scm
index 5bd4d1f8c2..e1e75d8556 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -43,6 +43,7 @@
#:export (_
N_
P_
+ report-error
leave
show-version-and-exit
show-bug-report-information