Having ran into a problem of deserializing a custom exception which belongs to an external library which is a subclass of Exception, I found that in ext/oj/oj.c there is a note saying that only Exceptions that take one require string argument are supported. And the reason is because of the mesg attribute that cannot be set using normal C or Ruby calls.
As I was previously using YAML for serializing/deserializing data, and it had no problem dealing with Exceptions, I did a check on its implementation (the standard YAML library distributed with Ruby). This is what I found how an exception object is built:
VALUE e = rb_obj_alloc(klass);
rb_iv_set(e, "mesg", mesg);
Just would like to check with you if using the call rb_iv_set works now? Or if there is any problem where using rb_iv_set doesn't actually set the exception message properly?
Thank you.
I'll check again. It has been some number of years since I revisited that.
Please check the exception branch. It looks like I had already done most of the work needed. I just needed to remove the unnecessary code.
@ohler55 Awesome! It works for me. Thank you.
Great. I have two branches going into the next release this week.
Release 3.7.7 has a fix.
Great. Thank you!