So, for instance, we have this for R 3.6.x as well as 4.0.x:
trajectory() %>% log_(1)
#> Error: log_: 'message' is not a valid character or function
But then, for R 4.1.x:
trajectory() %>% log_(1)
#> Error: check_args: 'message' is not a valid character or function
and R 4.2.x:
trajectory() %>% log_(1)
#> Error: stop: 'message' is not a valid character or function
which means that we cannot rely on a fixed stack position. It's better to perform a (limited) search, e.g.,
get_caller <- function(max.depth=10) {
for (i in seq_len(max.depth)) {
fun <- as.character(sys.call(-i-1)[[1]])
if (grepl("\\.(simmer|trajectory)$", fun))
return(strsplit(fun, ".", fixed=TRUE)[[1]][1])
}
return("")
}
Caller identification for error printing is made here:
https://github.com/r-simmer/simmer/blob/ca6632e5e28223872dcc86dda9f0c21b65fbe59b/R/utils.R#L42-L44
So, for instance, we have this for R 3.6.x as well as 4.0.x:
But then, for R 4.1.x:
and R 4.2.x:
which means that we cannot rely on a fixed stack position. It's better to perform a (limited) search, e.g.,