In particular the call and cppstack elements are not being populated appropriately. Looks like this condition object is created from exception_to_r_condition. The same behavior exists on MacOS (clang) and Windows. I did not test Linux.
Rcpp::sourceCpp("2013-01-13-intro-to-exceptions.cpp", embeddedR = FALSE)
str(tryCatch(takeLog(-1.0), error = function(e) e))
#> List of 3
#> $ message : chr "Inadmissible value"
#> $ call : language eval(substitute(expr), envir, enclos)
#> $ cppstack: NULL
#> - attr(*, "class")= chr [1:4] "std::range_error" "C++Error" "error" "condition"
R version 3.3.0 (2016-05-03)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.6 (El Capitan)
attached base packages:
 stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
 tools_3.3.0 Rcpp_0.12.7
Thanks for filing this. I noticed that too in the (printed) value of call when exiting via Rcpp::stop() from some tests. Not sure when the regression got introduced. This used to work :-/
Looks like ccb3259 was when this was introduced. The commit prior prints <std::range_error: Inadmissible value> as was expected.
<std::range_error: Inadmissible value>
However I am still a little unclear when the call and cppstack values should be populated, even in the prior commit (b50768d) they are both NULL regardless of where the exception comes from in C++ or R call stacks.
FWIW, the main calls that are used to construct the stack trace are here: https://github.com/RcppCore/Rcpp/blob/88ebc36c89789c035135ca9b35dcfb316d2bce94/inst/include/Rcpp/exceptions.h#L152-L183
With other stuff in https://github.com/RcppCore/Rcpp/blob/88ebc36c89789c035135ca9b35dcfb316d2bce94/src/barrier.cpp.
I recall that we did a bunch of crazy stuff around error, warning and message handling but had to roll it back as it broke the handling of Rcpp_eval() within some contexts. Maybe we need to restore some of the error handling / tracking code in Rcpp_eval()?
My memory is also fuzzy. I am also unclear whether we ever explicitly filled call and cppstack. Didn't we just catch and call R's error return function with an appropriate message?
It may be this commit that broke things: 454de74
Note that prior to this we had calls to the error recorder: https://github.com/RcppCore/Rcpp/blob/1c90562c81c8ae3c3cee24de978798e7b4c5f8be/inst/include/Rcpp/api/meat/Rcpp_eval.h#L80-L90
We probably need to restore these error-recording calls in Rcpp_eval() (it looks like I accidentally removed them).