Skip to content

C++ exceptions are not generating proper condition objects #579

@jimhester

Description

@jimhester

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.

Steps to reproduce

download.file("https://github.com/RcppCore/rcpp-gallery/raw/gh-pages/src/2013-01-13-intro-to-exceptions.cpp", "2013-01-13-intro-to-exceptions.cpp")
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"
Session Info
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)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] tools_3.3.0 Rcpp_0.12.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions