guile-user
[Top][All Lists]
Advanced

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

Is there a way to transparently re-throw?


From: Rob Browning
Subject: Is there a way to transparently re-throw?
Date: 27 Feb 2001 12:00:44 -0600
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

I was trying to set up a catch handler that would catch all
exceptions, take some cleanup action, and then, if the error wasn't
one the handler was particularly interested in, re-throw the error
*without* affecting the error's source.

You can almost do that like this:

  (define (handle-throw key . throw-args)
    (cleanup)
    (if (eq? key 'foo)
        (do-something)
        (apply throw key throw-args)))

but if you do, whenever the pass-through "apply" clause fires, it
changes at least the debugging output to make it look like the
original error occurred at the point of the apply, rather than at the
original source.

Basically, I'd like something kinda like (next-method) for exceptions.

Thanks

-- 
Rob Browning <address@hidden> PGP=E80E0D04F521A094 532B97F5D64E3930



reply via email to

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