[Top][All Lists]

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

[shepherd] 02/02: service: Adjust 'action' exception handler to Guile 3.

From: Ludovic Courtès
Subject: [shepherd] 02/02: service: Adjust 'action' exception handler to Guile 3.0.
Date: Thu, 2 Jan 2020 13:00:32 -0500 (EST)

civodul pushed a commit to branch master
in repository shepherd.

commit e5e125ae6b46e21312c2049f58c6913413629c16
Author: Ludovic Courtès <address@hidden>
Date:   Thu Jan 2 18:56:46 2020 +0100

    service: Adjust 'action' exception handler to Guile 3.0.
    * modules/shepherd/service.scm (action): Adjust 'catch' handler
    wrt. SRFI-34 exceptions to Guile 2.9.7/2.9.8 by checking whether KEY is
    '%exception and using 'raise-exception' instead of 'throw' to re-throw
    the exception.
 modules/shepherd/service.scm | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index bd7e379..321ae58 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -485,9 +485,14 @@ is not already running, and will return SERVICE's 
canonical name in a list."
         (and (eq? root-service obj)
              (eq? key 'quit)
              (apply quit args))
-        (if (eq? key 'srfi-34)
-            (apply throw key args)                ;handled by callers
-            (report-exception the-action obj key args))))))
+        ;; Re-throw SRFI-34 exceptions that the caller will handle.
+        (cond ((eq? key 'srfi-34)                 ;Guile 2.x
+               (apply throw key args))
+              ((eq? key '%exception)              ;Guile 3.x
+               (raise-exception (car args)))
+              (else
+               (report-exception the-action obj key args)))))))
 ;; Display documentation about the service.
 (define-method (doc (obj <service>) . args)

reply via email to

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