guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[shepherd] 05/06: shepherd: Better report key&args exceptions from confi


From: Ludovic Courtès
Subject: [shepherd] 05/06: shepherd: Better report key&args exceptions from config file loading.
Date: Wed, 8 May 2024 19:34:39 -0400 (EDT)

civodul pushed a commit to branch devel
in repository shepherd.

commit 28f69f5c0ab8704fcf3b83e6f7746b0800d66f47
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Wed May 8 18:05:59 2024 +0200

    shepherd: Better report key&args exceptions from config file loading.
    
    * modules/shepherd.scm 
(configuration-file-loader)[handle-key-and-args-exception]:
    Use ‘print-exception’ unconditionally to report the error.
---
 modules/shepherd.scm | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/modules/shepherd.scm b/modules/shepherd.scm
index 0519418..f7e302b 100644
--- a/modules/shepherd.scm
+++ b/modules/shepherd.scm
@@ -167,15 +167,13 @@ using fallback mechanism."))
     #f)
 
   (define (handle-key-and-args-exception key args)
-    (match key
-      ('system-error
-       (local-output
-        (l10n "While loading configuration file '~a': ~a")
-        file (strerror (system-error-errno (cons key args)))))
-      (_
-       (local-output
-        (l10n "Uncaught exception while loading configuration file '~a': ~s")
-        file (cons key args)))))
+    (local-output
+     (l10n "While loading configuration file '~a': ~s")
+     file
+     (string-trim-right
+      (call-with-output-string
+        (lambda (port)
+          (print-exception port #f key args))))))
 
   (lambda ()
     (guard (c ((action-runtime-error? c)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]