summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2015-03-16 08:59:59 -0400
committerDavid Thompson <dthompson2@worcester.edu>2015-03-16 19:42:54 -0400
commit5762f3062cc62855743c52b11a0de7cd54528981 (patch)
tree97bc939bffe7e006be1c21b15482474f804150c8
parent2f094a69f0d601d3b42052208eff0d6244ca7db1 (diff)
downloadguix-5762f3062cc62855743c52b11a0de7cd54528981.tar.gz
scripts: environment: Improve error messages.
* guix/scripts/environment.scm (guix-environment): Wrap procedure body with
  error handling form.
-rw-r--r--guix/scripts/environment.scm37
1 files changed, 19 insertions, 18 deletions
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index c96ca351c4..80ae924410 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -220,21 +220,22 @@ packages."
   (define (handle-argument arg result)
     (alist-cons 'package arg result))
 
-  (with-store store
-    (let* ((opts  (parse-command-line args %options (list %default-options)
-                                      #:argument-handler handle-argument))
-           (pure? (assoc-ref opts 'pure))
-           (command (assoc-ref opts 'exec))
-           (inputs (packages->transitive-inputs
-                    (pick-all (options/resolve-packages opts) 'package)))
-           (drvs (run-with-store store
-                   (mbegin %store-monad
-                     (set-guile-for-build (default-guile))
-                     (build-inputs inputs opts)))))
-      (cond ((assoc-ref opts 'dry-run?)
-             #t)
-            ((assoc-ref opts 'search-paths)
-             (show-search-paths inputs drvs pure?))
-            (else
-             (create-environment inputs drvs pure?)
-             (system command))))))
+  (with-error-handling
+    (with-store store
+      (let* ((opts  (parse-command-line args %options (list %default-options)
+                                        #:argument-handler handle-argument))
+             (pure? (assoc-ref opts 'pure))
+             (command (assoc-ref opts 'exec))
+             (inputs (packages->transitive-inputs
+                      (pick-all (options/resolve-packages opts) 'package)))
+             (drvs (run-with-store store
+                     (mbegin %store-monad
+                       (set-guile-for-build (default-guile))
+                       (build-inputs inputs opts)))))
+        (cond ((assoc-ref opts 'dry-run?)
+               #t)
+              ((assoc-ref opts 'search-paths)
+               (show-search-paths inputs drvs pure?))
+              (else
+               (create-environment inputs drvs pure?)
+               (system command)))))))