diff options
Diffstat (limited to 'guix/scripts/system.scm')
-rw-r--r-- | guix/scripts/system.scm | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index e2c6b2efee..992acdbca2 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." |