Le 2017-11-07 02:56, myglc2 a écrit :
Please note: these replies are separated by topics in an effort to make
the
threads more topical ...
On 11/06/2017 at 17:16 Leo Famulari writes:
On Mon, Nov 06, 2017 at 03:12:11PM -0500, myglc2 wrote:
[...]
Guix config errors are reported as raw scheme errors which are not
user-friendly, except, perhaps, to guile users ;-) Could we improve
this
situation by adding config troubleshooting guidance to the doc?
Yes, we do try to add helpful error messages, although obviously there
is a lot more work to be done.
I didn't mean this point critically. Rather as a statement of fact.
When
I said ...
Could we improve this situation by adding config troubleshooting
guidance to the doc?
... I was thinking something like ...
vvvvvvvvvvvvvvvvvv
Troubleshooting your config file:
If you get an error like:
ice-9/boot-9.scm:[...] no code for module (gnu packages <package name>)
You have either specified a package name that does not exist, or your
(use-package-modules <package module names>) does not contain the name
of a package module that contains the definition of <package name>.
You can determine which, if any, module contains a package definition
by
yada yada yada
^^^^^^^^^^^^^^^^^^
... thinking that then there would be a search hit in the doc for 'no
code for module' which might enable some users to understand what they
are doing wrong.
WDYT? - George
Hi George,
Since we encourage users to use use-package-modules etc, I think it's
better
to catch this error and explain it to users as soon as it happens. It's
more
friendly for users than a troubleshooting section in the manual. This
patch
would print:
Package module "abc" does not exist.
ERROR: In procedure scm-error:
ERROR: check "use-package-modules" line in your configuration.
If you try to use something like (use-package-modules linux abc), and
similar messages for services and system modules.
WDYT?
From c47acf0508358ff160719f728844a82a5db07d05 Mon Sep 17 00:00:00 2001
From: Julien Lepiller <jul...@lepiller.eu>
Date: Tue, 7 Nov 2017 11:46:34 +0100
Subject: [PATCH] Catch use-modules errors in configuration.
* gnu.scm (use-package-modules, use-service-modules, use-system-modules):
Catch use-modules errors and show a small explanation about it.
---
gnu.scm | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/gnu.scm b/gnu.scm
index 913ce6160..c269b2ab0 100644
--- a/gnu.scm
+++ b/gnu.scm
@@ -53,12 +53,32 @@
%public-modules)))
(define-syntax-rule (use-package-modules module ...)
- (use-modules (gnu packages module) ...))
+ (begin
+ (catch #t (lambda () (use-modules (gnu packages module)))
+ (lambda _
+ (format #t "Package module \"~a\" does not exist.\n"
+ (symbol->string 'module))
+ (error "check \"use-package-modules\" line in your configuration.")
+ ...))))
(define-syntax-rule (use-service-modules module ...)
- (use-modules (gnu services module) ...))
+ (begin
+ (catch #t (lambda () (use-modules (gnu services module)))
+ (lambda _
+ (format #t "Service module \"~a\" does not exist.\n"
+ (symbol->string 'module))
+ (error "check \"use-package-services\" line in your configuration.")
+ ...))))
+
(define-syntax-rule (use-system-modules module ...)
- (use-modules (gnu system module) ...))
+ (begin
+ (catch #t (lambda () (use-modules (gnu system module)))
+ (lambda _
+ (format #t "System module \"~a\" does not exist.\n"
+ (symbol->string 'module))
+ (error "check \"use-system-modules\" line in your configuration.")
+ ...))))
+
;;; gnu.scm ends here
--
2.15.0