-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception in a later function causes later to stop working #12
Comments
I think the problem is that, when there's an error in the callback function, It's not getting decremented because the destructor for The problem is in the Callback Here's a minimal example that illustrates: Rcpp::cppFunction(
includes = '
class MyClass {
public:
MyClass() {
fprintf(stderr, "MyClass constructor\\n");
}
~MyClass() {
fprintf(stderr, "MyClass destructor\\n");
}
};
',
code = '
void invoke(Function func) {
MyClass m;
try {
func();
} catch(std::exception &ex) {
forward_exception_to_r(ex);
}
}
'
)
invoke(function() {
cat("R code\n", file=stderr())
})
# MyClass constructor
# R code
# MyClass destructor
invoke(function() {
stop("Some sort of error")
cat("R code\n", file=stderr())
})
# MyClass constructor
# Error in invoke(function() { : Evaluation error: Some sort of error. |
I've filed an issue on Rcpp for this: RcppCore/Rcpp#753 |
Example:
This produces the following output when run in the terminal:
Something similar happens if, instead of
stop()
, you havebrowser()
, and thenQ
out of the browser -- future calls tolater()
don't do anything.The text was updated successfully, but these errors were encountered: