From: "Iñaki Baz Castillo" Date: 2009-10-22T22:13:53+09:00 Subject: Re: Creating and raising custom exception in Ruby C extension El Jueves, 22 de Octubre de 2009, Iñaki Baz Castillo escribió: > El Jueves, 22 de Octubre de 2009, Nikolai Lugovoi escribió: > > On Thu, Oct 22, 2009 at 3:55 PM, Iñaki Baz Castillo wrote: > > > VALUE class_standard_error = rb_const_get(rb_cObject, > > > rb_intern("StandardError")); VALUE argv[0]; > > > VALUE new_error = rb_class_new_instance(0, argv, > > > class_standard_error); rb_raise(new_error, "Oh an error ocurred !!!"); > > > > why not simple: > > > > VALUE custom_error = rb_define_class("CustomError", rb_eStandardError); > > rb_raise(custom_error, "An error occured!"); > > Thanks, I've realized right now that first parameter in "rb_raise" can be > "VALUE class". > > Let me try :) > > Really thanks a lot. > Done thanks to you: VALUE class_xdms_error = rb_define_class("XDMSError", rb_eStandardError); VALUE class_xdms_url_parsing_error = rb_define_class("XDMSURLParsingError", class_xdms_error); rb_raise(class_xdms_url_parsing_error, "An error occured!"); :) -- Iñaki Baz Castillo