diff options
Diffstat (limited to '')
-rw-r--r-- | doc/ref/guile/util.texi | 3 | ||||
-rw-r--r-- | module/hnh/util.scm | 9 |
2 files changed, 9 insertions, 3 deletions
diff --git a/doc/ref/guile/util.texi b/doc/ref/guile/util.texi index e2e90c84..f9e6527e 100644 --- a/doc/ref/guile/util.texi +++ b/doc/ref/guile/util.texi @@ -321,6 +321,9 @@ body. Restores the old values once we leave. Macro allowing multiple exception types to be caught. Each (symbol proc) pair expands to a regular @code{catch}, with the leftmost being innermost. + +@var{Symbol} can also be on the form @code{(pre-unwind @var{symbol})}, +then @code{with-throw-handler} is used instead of @code{catch}. @end defmac @subsection UUID generation diff --git a/module/hnh/util.scm b/module/hnh/util.scm index bd38a445..929f23a0 100644 --- a/module/hnh/util.scm +++ b/module/hnh/util.scm @@ -538,9 +538,12 @@ (define-syntax catch* - (syntax-rules () + (syntax-rules (pre-unwind) + ((_ thunk ((pre-unwind key) handler)) + (with-throw-handler (quote key) thunk handler)) ((_ thunk (key handler)) (catch (quote key) thunk handler)) - ((_ thunk (key handler) rest ...) - (catch* (lambda () (catch (quote key) thunk handler)) + + ((_ thunk pair rest ...) + (catch* (lambda () (catch* thunk pair)) rest ...)))) |