[Top][All Lists]

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

Re: [Chicken-users] Rethrowing an exception

From: Christian Kellermann
Subject: Re: [Chicken-users] Rethrowing an exception
Date: Fri, 13 Nov 2015 09:37:50 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

Hey Mathieu!

* address@hidden <address@hidden> [151113 01:52]:
> Hi all,
> I have this piece of code I use to ensure any system resource being allocated
> gets released:
>     ;; invokes a procedure with the guarantee
>     ;; the allocated resource will be released
>     (define (with-release allocation-procedure procedure release-procedure)
>       (let ((allocated-resource (allocation-procedure)))
>         (handle-exceptions
>           exception
>           (begin
>             (release-procedure allocated-resource)
>             (abort exception))
>           (let ((procedure-result (procedure allocated-resource)))
>             (release-procedure allocated-resource)
>             procedure-result))))
> Works beautifully, but I seem to be loosing the backtrace from the original
> (abort). Is there anyway I can catch an exception but then let it continue as
> if nothing had ever happened?

The construction of the condition and the handler call will always be
visible, see also "Making continuable exceptions" at

Another idea worth trying is to capture the continuation before
calling the procedure in question, then calling that in the condition



May you be peaceful, may you live in safety, may you be free from
suffering, and may you live with ease.

reply via email to

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