-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Labels
Description
Error description
I tried to access a variable from a module but had mistyped the name, so it tried to throw an error with message "name '%s' not found in '%s'". Instead of doing that, it threw a different error with message "'Rf_translateChar' must be called on a CHARSXP, but got 'symbol'" because the C function assumes the first argument is a symbol. As an example:
box::use(utils)
x <- list(utils = utils)
x$utils$testI'm not sure what the exact expected output would be, but any of the following error messages would suffice:
stop(sprintf("name '%s' not found in '%s'", "test", "x$utils"))stop(sprintf("name '%s' not found in '%s'", "test", attr(x$utils, "name")))stop(sprintf("name '%s' not found in '%s'", "test", attr(x$utils, "spec")$alias))
That being said, I think your C code to generate such an error is unnecessarily complex, and could be greatly simplified with the use of .External2 instead of .Call. I could submit a PR if you like!
R version
platform x86_64-w64-mingw32
arch x86_64
os mingw32
crt ucrt
system x86_64, mingw32
status
major 4
minor 3.3
year 2024
month 02
day 29
svn rev 86002
language R
version.string R version 4.3.3 (2024-02-29 ucrt)
nickname Angel Food Cake
‘box’ version
[1] ‘1.2.0’