Hi, by using rb_protect() I can get an integer "exception" which I can
use within rb_jump_tag(exception) and that causes the exception to be
executed.
Ok, but what I need is the associated Ruby exception object that
"exception" integer points to. How to get it?
Thanks a lot.
···
--
Iñaki Baz Castillo
<ibc@aliax.net>
If I remember correctly, you can get an "active" exception for the current
thread with rb_errinfo.
-Martin
···
2012/4/30 Iñaki Baz Castillo <ibc@aliax.net>:
Hi, by using rb_protect() I can get an integer "exception" which I can
use within rb_jump_tag(exception) and that causes the exception to be
executed.
Ok, but what I need is the associated Ruby exception object that
"exception" integer points to. How to get it?
Thanks, it does the job
However I've a second problem:
I use rb_protect() so the exception is not executed and, indeed, I can
get it (the VALUE) using rb_errinfo().
The problem is that the exception seems to remain "alive" in the
thread, so when the thread ends the exception is raised!
How to avoid that? this is: how to tell the thread "please forgive the
last exception forever"?
Thanks a lot.
···
2012/4/30 Martin Boßlet <martin.bosslet@googlemail.com>:
Ok, but what I need is the associated Ruby exception object that
"exception" integer points to. How to get it?
If I remember correctly, you can get an "active" exception for the current
thread with rb_errinfo.
--
Iñaki Baz Castillo
<ibc@aliax.net>
However I've a second problem:
I use rb_protect() so the exception is not executed and, indeed, I can
get it (the VALUE) using rb_errinfo().
The problem is that the exception seems to remain "alive" in the
thread, so when the thread ends the exception is raised!
How to avoid that? this is: how to tell the thread "please forgive the
last exception forever"?
Thanks a lot.
Untested, but again I think setting the active exception to nil by
issuing
rb_set_errinfo(Qnil);
should "swallow" the exception. However, there could be a more
elegant way to this...
-Martin
And again it properly works
···
2012/4/30 Martin Boßlet <martin.bosslet@googlemail.com>:
The problem is that the exception seems to remain "alive" in the
thread, so when the thread ends the exception is raised!
How to avoid that? this is: how to tell the thread "please forgive the
last exception forever"?
Thanks a lot.
Untested, but again I think setting the active exception to nil by
issuing
rb_set_errinfo(Qnil);
should "swallow" the exception. However, there could be a more
elegant way to this...
--
Iñaki Baz Castillo
<ibc@aliax.net>