| 332 | |
| 333 | template <typename Exception> |
| 334 | inline SEXP exception_to_condition_template( const Exception& ex, bool include_call) { |
| 335 | #ifndef RCPP_NO_RTTI |
| 336 | std::string ex_class = demangle( typeid(ex).name() ) ; |
| 337 | #else |
| 338 | std::string ex_class = "<not available>"; |
| 339 | #endif |
| 340 | std::string ex_msg = ex.what() ; |
| 341 | |
| 342 | Rcpp::Shelter<SEXP> shelter; |
| 343 | SEXP call, cppstack; |
| 344 | if (include_call) { |
| 345 | call = shelter(get_last_call()); |
| 346 | cppstack = shelter(rcpp_get_stack_trace()); |
| 347 | } else { |
| 348 | call = R_NilValue; |
| 349 | cppstack = R_NilValue; |
| 350 | } |
| 351 | SEXP classes = shelter( get_exception_classes(ex_class) ); |
| 352 | SEXP condition = shelter( make_condition( ex_msg, call, cppstack, classes) ); |
| 353 | rcpp_set_stack_trace( R_NilValue ) ; |
| 354 | return condition ; |
| 355 | } |
| 356 | |
| 357 | inline SEXP rcpp_exception_to_r_condition(const Rcpp::exception& ex) { |
| 358 | ex.copy_stack_trace_to_r(); |
no test coverage detected