From c47acf0508358ff160719f728844a82a5db07d05 Mon Sep 17 00:00:00 2001 From: Julien Lepiller
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