MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / exception

Class exception

inst/include/Rcpp/exceptions.h:37–62  ·  view source on GitHub ↗

Throwing an exception must be thread-safe to avoid surprises w/ OpenMP.

Source from the content-addressed store, hash-verified

35
36 // Throwing an exception must be thread-safe to avoid surprises w/ OpenMP.
37 class exception : public std::exception {
38 public:
39 explicit exception(const char* message_, bool include_call = RCPP_DEFAULT_INCLUDE_CALL) : // #nocov start
40 message(message_),
41 include_call_(include_call) {
42 record_stack_trace();
43 }
44 exception(const char* message_, const char*, int, bool include_call = RCPP_DEFAULT_INCLUDE_CALL) :
45 message(message_),
46 include_call_(include_call) {
47 record_stack_trace();
48 }
49 bool include_call() const {
50 return include_call_;
51 }
52 virtual ~exception() throw() {}
53 virtual const char* what() const throw() {
54 return message.c_str(); // #nocov end
55 }
56 inline void copy_stack_trace_to_r() const;
57 private:
58 std::string message;
59 bool include_call_;
60 std::vector<std::string> stack;
61 inline void record_stack_trace();
62 };
63
64 // simple helper
65 static std::string toString(const int i) { // #nocov start

Callers 12

takeLogRcppFunction · 0.85
takeLogRcppLocationFunction · 0.85
noCallFunction · 0.85
Rcpp_exceptionFunction · 0.85
test_cpp_interfaceFunction · 0.85
stopFunction · 0.85
checked_getMethod · 0.85
checkIfSetMethod · 0.85
parseParametersMethod · 0.85
doWriteFunctionsMethod · 0.85
generateRMethod · 0.85
compileAttributesFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_cpp_interfaceFunction · 0.68