[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: improve error message for `guix environment'
From: |
David Thompson |
Subject: |
Re: improve error message for `guix environment' |
Date: |
Mon, 16 Mar 2015 09:04:31 -0400 |
User-agent: |
Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (x86_64-pc-linux-gnu) |
Tomáš Čech <address@hidden> 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!
>From 13113846f0f19b57f271dc71b5cbc606d8c2b68a Mon Sep 17 00:00:00 2001
From: David Thompson <address@hidden>
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
--
David Thompson
Web Developer - Free Software Foundation - http://fsf.org
GPG Key: 0FF1D807
Support the FSF: https://fsf.org/donate