[Rcpp-devel] RCPP_USE_UNWIND_PROTECT by default
Jeroen Ooms
jeroenooms at gmail.com
Sun Feb 6 18:39:35 CET 2022
On Sun, Feb 6, 2022 at 6:25 PM Kevin Ushey <kevinushey at gmail.com> wrote:
>
> If I tweak your example package code so that all exceptions are caught via a catch (...) {} block, I can see something like:
>
> > uptest::uptest()
> Error in (function () : Ouch from R
> Caught some other exception.
>
> The fact that we're still printing the R error message seems undesirable, but it looks like the exception can be caught -- just not via std::exception.
Yes that is also what IƱaki and me alluded to above. But I think this
way, what we are catching is not the R error itself (which seems lost
after it was printed), but rather a token that tells the application
we should let Rcpp unwind all the way back to the R console. Which is
what happens if we don't catch it, then it makes sense. But if we _do_
want to handle the situation in C++, this doesn't give us much to work
with.
More information about the Rcpp-devel
mailing list