romainfrancois commented on a change in pull request #7819:
URL: https://github.com/apache/arrow/pull/7819#discussion_r459550356
##########
File path: r/tests/testthat/test-Array.R
##########
@@ -131,14 +131,14 @@ test_that("Slice() and RangeEquals()", {
expect_true(x$RangeEquals(z, 10, 15, 0))
# Input validation
- expect_error(x$Slice("ten"), class = "Rcpp::not_compatible")
+ expect_error(x$Slice("ten"))
Review comment:
As far as I can see, `cpp11::stop()` calls `Rf_error()` directly without
setting specific exception classes. cc @jimhester but it wasn't that useful to
have dedicated exception classes.
https://github.com/r-lib/cpp11/blob/master/inst/include/cpp11/protect.hpp#L205
specifically the conversion is refused by `cpp11::stop()` here:
https://github.com/r-lib/cpp11/blob/master/inst/include/cpp11/as.hpp#L45 so no
additional class.
```cpp
template <typename T>
is_integral<T> as_cpp(SEXP from) {
if (Rf_isInteger(from)) {
if (Rf_xlength(from) == 1) {
return INTEGER_ELT(from, 0);
}
} else if (Rf_isReal(from)) {
if (Rf_xlength(from) == 1) {
double value = REAL_ELT(from, 0);
if (is_convertable_without_loss_to_integer(value)) {
return value;
}
}
}
stop("Expected single integer value");
return T();
}
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]