diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2015-01-22 22:43:46 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2015-01-22 22:43:46 +0100 |
| commit | 70e629f5483bd3a5bf9c27e9f401d7d933dc222d (patch) | |
| tree | d3756e410a891ea75b0e1beea50ff1ab17cad904 | |
| parent | fbb020451ea25896936a5fba966612b59c0bcdf3 (diff) | |
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.scm | 13 | ||||
| -rw-r--r-- | guix/ui.scm | 1 |
2 files changed, 9 insertions, 5 deletions
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index b0974dcfcd6..3eea872fe89 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm | |||
| @@ -76,11 +76,14 @@ | |||
| 76 | file (strerror err)))) | 76 | file (strerror err)))) |
| 77 | (('syntax-error proc message properties form . rest) | 77 | (('syntax-error proc message properties form . rest) |
| 78 | (let ((loc (source-properties->location properties))) | 78 | (let ((loc (source-properties->location properties))) |
| 79 | (leave (_ "~a: ~a~%") | 79 | (format (current-error-port) (_ "~a: error: ~a~%") |
| 80 | (location->string loc) message))) | 80 | (location->string loc) message) |
| 81 | (_ | 81 | (exit 1))) |
| 82 | (leave (_ "failed to load operating system file '~a': ~s~%") | 82 | ((error args ...) |
| 83 | file args)))))) | 83 | (report-error (_ "failed to load operating system file '~a':~%") |
| 84 | file) | ||
| 85 | (apply display-error #f (current-error-port) args) | ||
| 86 | (exit 1)))))) | ||
| 84 | 87 | ||
| 85 | 88 | ||
| 86 | ;;; | 89 | ;;; |
diff --git a/guix/ui.scm b/guix/ui.scm index 5bd4d1f8c24..e1e75d85567 100644 --- a/guix/ui.scm +++ b/guix/ui.scm | |||
| @@ -43,6 +43,7 @@ | |||
| 43 | #:export (_ | 43 | #:export (_ |
| 44 | N_ | 44 | N_ |
| 45 | P_ | 45 | P_ |
| 46 | report-error | ||
| 46 | leave | 47 | leave |
| 47 | show-version-and-exit | 48 | show-version-and-exit |
| 48 | show-bug-report-information | 49 | show-bug-report-information |
