aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2016-02-22 15:36:12 +0000
committerJustus Winter <[email protected]>2016-04-21 13:36:34 +0000
commitcfcebf3c54b46ef3f5247ffb2b39fbe2ab859170 (patch)
tree7f6444ff6d3ab3425218b420ab439658138d6a92
parenttests/gpgscm: Add package macro. (diff)
downloadgnupg-cfcebf3c54b46ef3f5247ffb2b39fbe2ab859170.tar.gz
gnupg-cfcebf3c54b46ef3f5247ffb2b39fbe2ab859170.zip
tests/gpgscm: Make exception value available.
* tests/gpgscm/init.scm (throw): Hand exception value to the handler. (catch): And bind it to *error*.
-rw-r--r--tests/gpgscm/init.scm9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/gpgscm/init.scm b/tests/gpgscm/init.scm
index 630f27a70..0889366af 100644
--- a/tests/gpgscm/init.scm
+++ b/tests/gpgscm/init.scm
@@ -542,8 +542,9 @@
; (if-something goes-wrong)
; (with-these calls))
;
-; "Catch" establishes a scope spanning multiple call-frames
-; until another "catch" is encountered.
+; "Catch" establishes a scope spanning multiple call-frames until
+; another "catch" is encountered. Within the recovery expression
+; the thrown exception is bound to *error*.
;
; Exceptions are thrown with:
;
@@ -566,13 +567,13 @@
(define (throw . x)
(if (more-handlers?)
- (apply (pop-handler))
+ (apply (pop-handler) x)
(apply error x)))
(macro (catch form)
(let ((label (gensym)))
`(call/cc (lambda (exit)
- (push-handler (lambda () (exit ,(cadr form))))
+ (push-handler (lambda (*error*) (exit ,(cadr form))))
(let ((,label (begin ,@(cddr form))))
(pop-handler)
,label)))))