Closed DavisVaughan closed 2 years ago
I should also add that if you run the reprex above with reprex::reprex()
then even the first example without the tryCatch()
will show the warning anyways.
library(future)
plan(sequential)
expr <- quote({
warning("oh no")
1
})
# We dont see anything about the warning here (OH WAIT WE DO WITH reprex()!)
value(future(expr, substitute = FALSE, conditions = NULL))
#> Warning in eval(quote({: oh no
#> [1] 1
Created on 2022-04-29 by the reprex package (v2.0.1)
conditions = character(0)
captures all conditions and drops them immediately, because there's no match. This comes with some overhead
conditions = NULL
doesn't intercept conditions at all, i.e. it won't capture them and let them bubble up to the top. This comes with minimal overhead. It corresponds to what stdout = NA
. These are mostly there for low-level troubleshooting. The help page could be improved on this. (Eventually these special values could become an error)
I've updated help(future)
to clarify this, cf. https://future.futureverse.org/reference/future.html
Okay that makes more sense now, thanks!
If I understand correctly,
conditions = NULL
should completely ignore all conditions. It does seem like they aren't propagated up to the user when you execute the future, but if youtryCatch()
it you can see that the warning is still being signaled (with sequential and multicore). Strangely, it seems likeconditions = character()
does the "right" thing here. I thought the two should be identical in behavior.This came up while trying to add a test to ensure that
conditions = NULL
doesn't relay any warnings.Created on 2022-04-29 by the reprex package (v2.0.1)