romainfrancois commented on pull request #11534:
URL: https://github.com/apache/arrow/pull/11534#issuecomment-964995310
One thing we could do maybe is to add a `call` to the error, this would
still be a `simpleError` but at least we could identify that it is from a
status, and then only attempt to simplify in that case, e.g.
```cpp
static inline void StopIfNotOk(const Status& status) {
if (!status.ok()) {
SEXP call = Rf_lang1(Rf_install("StopIfNotOk"));
cpp11::safe.noreturn(Rf_errorcall)(call, "%s",
status.ToString().c_str());
}
}
```
```r
err_remove_context <- function(cnd) {
if (identical(cnd$call, call("StopIfNotOk"))) {
msg <- strsplit(cnd$message, "\n")[[1]]
msg <- msg[!grepl("^.*:\\d+ ", msg)]
cnd$message <- paste(msg, collapse = "\n")
rlang::cnd_signal(cnd)
}
}
```
but perhaps there are plans in `cpp11` to be able to throw classed
exceptions ? cc @jimhester
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]