Catching runtime exceptions from callbacks

R

remigillig

Hello,

I am currently integrating Ruby (1.8.6) inside an application. Until
now, I had no impossible problem although the API documentation is a
bit poor.

I use rb_load_protect to load a startup script file that contains some
callbacks like this :
Events.onChar { |char|
print("char:#{char}");
}
If there is an error while loading the file, I can catch it and get
the backtrace and everything I want because it's inside protect(). But
if I use for example raise inside the callback, my program stops due
to a C++ runtime exception (here it's not inside protect() anymore
because rb_load_protect returns after the file has been loaded).

I don't know if it is possible but I would like to be able to also
catch RuntimeError (and all others) in my C++ code.
Thanks.

Remi Gillig.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,125
Latest member
VinayKumar Nevatia_
Top