# C API: Get the error associated with a RUBY\_EVENT\_RAISE even

**URL:** <https://www.ruby-forum.com/t/c-api-get-the-error-associated-with-a-ruby-event-raise-even/74652>\
**Category:** Ruby\
**Created:** [November 7, 2006, 10:51am UTC](https://www.ruby-forum.com/t/c-api-get-the-error-associated-with-a-ruby-event-raise-even/74652 "2006-11-07T10:51:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![elliterate](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/9de053/32.png) [@elliterate](https://www.ruby-forum.com/u/elliterate)\
**Post date:** [November 7, 2006, 10:51am UTC](https://www.ruby-forum.com/t/c-api-get-the-error-associated-with-a-ruby-event-raise-even/74652/1 "2006-11-07T10:51:38Z")

</div>

Hi,

I’m using rb\_add\_event\_hook() with the RUBY\_EVENT\_RAISE flag, and I’m  
struggling to find a function to tell me what error actually happened.  
I know where it happened with rb\_backtrace() which is great, but I still  
need the name of the error.

Maybe I’m looking in the wrong place, but the documentation for the C  
API is  
pretty much non-existent. Sure, we have doxygen generated lists of files  
and  
functions but that’s next to worthless without a description of what  
each  
function does. The README only seems to cover the most common tasks, and  
brief at that.

Cheers  
Ian.

---

<div class="post-metadata">

**Author:** ![elliterate](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/9de053/32.png) [@elliterate](https://www.ruby-forum.com/u/elliterate)\
**Post date:** [November 7, 2006, 10:51am UTC](https://www.ruby-forum.com/t/c-api-get-the-error-associated-with-a-ruby-event-raise-even/74652/2 "2006-11-07T10:51:47Z")

</div>

On Wed, Nov 01, 2006 at 10:31:54PM +0900, Ian L. wrote:

> Hi,
> 
> I’m using rb\_add\_event\_hook() with the RUBY\_EVENT\_RAISE flag, and I’m  
> struggling to find a function to tell me what error actually happened.  
> I know where it happened with rb\_backtrace() which is great, but I still  
> need the name of the error.

The last exception raised is stored in ruby\_errinfo.

> Maybe I’m looking in the wrong place, but the documentation for the C API is  
> pretty much non-existent. Sure, we have doxygen generated lists of files and  
> functions but that’s next to worthless without a description of what each  
> function does. The README only seems to cover the most common tasks, and  
> brief at that.

I agree; we should have better C documentation. What we do have:

- README.EXT
- The pickaxe book
- the ruby hacking guide - [http://rhg.rubyforge.org/](http://rhg.rubyforge.org/)
- the ruby source code (I use this a lot)
- [ruby embedded into c++](http://metaeditor.sourceforge.net/embed/)
- numerous articles on the web

Perhaps someone should start a project to document the API.

Paul
