guix-commits
[Top][All Lists]
Advanced

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

03/04: guix system: Properly report Shepherd errors when upgrading servi


From: Ludovic Courtès
Subject: 03/04: guix system: Properly report Shepherd errors when upgrading services.
Date: Tue, 2 Aug 2016 21:45:43 +0000 (UTC)

civodul pushed a commit to branch master
in repository guix.

commit aa1e73a996ad170fecac848f203528aeb3d2173e
Author: Ludovic Courtès <address@hidden>
Date:   Tue Aug 2 22:57:09 2016 +0200

    guix system: Properly report Shepherd errors when upgrading services.
    
    Fixes regression introduced in 8bf92e3904cb656d4c2160fc8befebaf21a65492.
    Reported by myglc2 <address@hidden> in <http://bugs.gnu.org/24135>.
    
    * guix/scripts/system.scm (with-shepherd-error-handling): Rename 'body'
    to 'mbody'.  Expand to a monadic procedure that runs MBODY.
---
 guix/scripts/system.scm |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index e2c6b2e..992acdb 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -236,11 +236,15 @@ BODY..., and restore them."
       (with-monad %store-monad
         (return #f)))))
 
-(define-syntax-rule (with-shepherd-error-handling body ...)
-  (warn-on-system-error
-   (guard (c ((shepherd-error? c)
-              (report-shepherd-error c)))
-     body ...)))
+(define-syntax-rule (with-shepherd-error-handling mbody ...)
+  "Catch and report Shepherd errors that arise when binding MBODY, a monadic
+expression in %STORE-MONAD."
+  (lambda (store)
+    (warn-on-system-error
+     (guard (c ((shepherd-error? c)
+                (report-shepherd-error c)))
+       (values (run-with-store store (begin mbody ...))
+               store)))))
 
 (define (report-shepherd-error error)
   "Report ERROR, a '&shepherd-error' error condition object."



reply via email to

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