unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David Thompson <dthompson2@worcester.edu>
To: "Tomáš Čech" <sleep_walker@gnu.org>, guix-devel@gnu.org
Subject: Re: improve error message for `guix environment'
Date: Mon, 16 Mar 2015 09:04:31 -0400	[thread overview]
Message-ID: <87r3sp14bk.fsf@fsf.org> (raw)
In-Reply-To: <20150316083300.GB15469@venom>

[-- Attachment #1: Type: text/plain, Size: 381 bytes --]

Tomáš Čech <sleep_walker@gnu.org> writes:

> When network issue occurs during `guix environment <package>' call,
> the error message is too cryptic:

If you can reproduce it, could you please apply this patch and tell me
if it makes things any better?  The 'with-error-handling' form will
catch a bunch of possible errors and print out friendlier messages.

Thanks!


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-scripts-environment-Improve-error-messages.patch --]
[-- Type: text/x-diff, Size: 2498 bytes --]

From 13113846f0f19b57f271dc71b5cbc606d8c2b68a Mon Sep 17 00:00:00 2001
From: David Thompson <dthompson2@worcester.edu>
Date: Mon, 16 Mar 2015 08:59:59 -0400
Subject: [PATCH] scripts: environment: Improve error messages.

* guix/scripts/environment.scm (guix-environmnet): Wrap procedure body with
  error handling form.
---
 guix/scripts/environment.scm | 37 +++++++++++++++++++------------------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index c96ca35..80ae924 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)))))))
-- 
2.1.4


[-- Attachment #3: Type: text/plain, Size: 136 bytes --]


-- 
David Thompson
Web Developer - Free Software Foundation - http://fsf.org
GPG Key: 0FF1D807
Support the FSF: https://fsf.org/donate

  reply	other threads:[~2015-03-16 13:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-16  8:33 improve error message for `guix environment' Tomáš Čech
2015-03-16 13:04 ` David Thompson [this message]
2015-03-16 15:47   ` Ludovic Courtès
2015-03-16 16:12     ` Ricardo Wurmus
2015-03-16 16:17       ` Thompson, David
2015-03-16 23:49     ` David Thompson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r3sp14bk.fsf@fsf.org \
    --to=dthompson2@worcester.edu \
    --cc=guix-devel@gnu.org \
    --cc=sleep_walker@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).