mirror of
git://git.gnupg.org/gnupg.git
synced 2025-04-13 22:21:09 +02:00
tests/gpgscm: Make exception value available.
* tests/gpgscm/init.scm (throw): Hand exception value to the handler. (catch): And bind it to *error*.
This commit is contained in:
parent
6c225eb02f
commit
cfcebf3c54
@ -542,8 +542,9 @@
|
|||||||
; (if-something goes-wrong)
|
; (if-something goes-wrong)
|
||||||
; (with-these calls))
|
; (with-these calls))
|
||||||
;
|
;
|
||||||
; "Catch" establishes a scope spanning multiple call-frames
|
; "Catch" establishes a scope spanning multiple call-frames until
|
||||||
; until another "catch" is encountered.
|
; another "catch" is encountered. Within the recovery expression
|
||||||
|
; the thrown exception is bound to *error*.
|
||||||
;
|
;
|
||||||
; Exceptions are thrown with:
|
; Exceptions are thrown with:
|
||||||
;
|
;
|
||||||
@ -566,13 +567,13 @@
|
|||||||
|
|
||||||
(define (throw . x)
|
(define (throw . x)
|
||||||
(if (more-handlers?)
|
(if (more-handlers?)
|
||||||
(apply (pop-handler))
|
(apply (pop-handler) x)
|
||||||
(apply error x)))
|
(apply error x)))
|
||||||
|
|
||||||
(macro (catch form)
|
(macro (catch form)
|
||||||
(let ((label (gensym)))
|
(let ((label (gensym)))
|
||||||
`(call/cc (lambda (exit)
|
`(call/cc (lambda (exit)
|
||||||
(push-handler (lambda () (exit ,(cadr form))))
|
(push-handler (lambda (*error*) (exit ,(cadr form))))
|
||||||
(let ((,label (begin ,@(cddr form))))
|
(let ((,label (begin ,@(cddr form))))
|
||||||
(pop-handler)
|
(pop-handler)
|
||||||
,label)))))
|
,label)))))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user