This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Exceptions


Daniel Burrows wrote:
> 
>   Hello.
> 
>   I'm in the process of embedding Guile into a C program, primarily by allowing
> the user (via configuration files and some runtime-entered scripts) to create
> "hook" procedures that get called in response to program events.  Currently,
> I'm experiencing a high level of frustration due to the fact that any error in
> the user-provided scripts will cause my program to abort with a Scheme error.
> I've tried (based on the tiny amount of documentation available and a fair
> amount of code-examination) to set up a catch handler for the main program body;
> however, even when my catch handler is invoked, my program still terminates
> on a Scheme error.  Is there any way to get around this feature?

For scwm I wrote some code to evaluate hook callbacks in a safe dynamic environment
that would catch errors and display nicely formatted error messages with line numbers
and backtraces. It's in the file callbacks.c in the scwm distribution. I reccomend
looking at that.

 - Maciej