From: "Suraj N. Kurapati" Date: 2008-03-31T06:25:28+09:00 Subject: C extension - how to print exception like Ruby? Hello, In reference to [ruby-talk:175758], how do I print the details of an exception (which is caught rb_protect() and passed to me by its return value) just like Ruby does? Currently, I am eval()ing some Ruby code to print the error details manually. But this does not produce beautiful output like Ruby. :-( int error; VALUE result; result = rb_protect(my_ruby_func, (VALUE)my_func_args, &error); if (error) { printf("caught an unhandled Ruby exception! \n"); rb_eval_string_protect( // <====== output is not beautiful "if (e = $!) then STDERR.puts" "(e.inspect, e.backtrace) end", &error ); } Is there a function in Ruby's C API that I can call to print the details of $! to STDERR? Thanks for your consideration.