aboutsummaryrefslogtreecommitdiff
path: root/guix/ui.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-03-07 19:29:12 +0100
committerLudovic Courtès <ludo@gnu.org>2013-03-07 19:44:14 +0100
commitef86c39f27b0d1c21435ea54cba5fb247e341537 (patch)
treeb0e93558496a06d6e0ee036f75423a083b8787b2 /guix/ui.scm
parent1fb78cb2c36a6b0d7a3ecf1f7150c4d99b01c1a9 (diff)
downloadgnu-guix-ef86c39f27b0d1c21435ea54cba5fb247e341537.tar
gnu-guix-ef86c39f27b0d1c21435ea54cba5fb247e341537.tar.gz
ui: Gracefully report failures to connect to the daemon.
* guix/store.scm (&nix-connection-error): New condition type. (open-connection): Translate `system-error' during the `connect' call into `&nix-connection-error'. * guix/ui.scm (call-with-error-handling): Add case for `nix-connection-error?'. * guix/scripts/package.scm (guix-package): Move `open-connection' call within `with-error-handling'. * guix/scripts/pull.scm (guix-pull): Likewise. * guix/scripts/download.scm (guix-download): Move body within `with-error-handling'.
Diffstat (limited to 'guix/ui.scm')
-rw-r--r--guix/ui.scm4
1 files changed, 4 insertions, 0 deletions
diff --git a/guix/ui.scm b/guix/ui.scm
index 03d881a428..94f0825a0a 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -111,6 +111,10 @@ General help using GNU software: <http://www.gnu.org/gethelp/>"))
(leave (_ "~a:~a:~a: error: package `~a' has an invalid input: ~s~%")
file line column
(package-full-name package) input)))
+ ((nix-connection-error? c)
+ (leave (_ "error: failed to connect to `~a': ~a~%")
+ (nix-connection-error-file c)
+ (strerror (nix-connection-error-code c))))
((nix-protocol-error? c)
;; FIXME: Server-provided error messages aren't i18n'd.
(leave (_ "error: build failed: ~a~%")