Catching exceptions from embedded ruby

I’m embedding Ruby in a C program. If the Ruby program throws an
exception, I’d like to catch it and print out the error. How could I
do that?

On 1/13/06, Joe Van D. [email protected] wrote:

I’m embedding Ruby in a C program. If the Ruby program throws an
exception, I’d like to catch it and print out the error. How could I
do that?

I can protect the function that might return an exception (via
rb_protect), but how can I display the reason why the exception was
thrown (hopefully along with a backtrace)?