Closed HenrikBengtsson closed 2 years ago
Just so I don't forget: re-reading my comment on StackOverflow made me remember that one possibly workaround might be to inspect the call stack to detect the special cases of message(<error>)
and warning(<error>)
. It could be that we can do that from within the future.
The cost for such extra overhead would only apply to error conditions, and since they are often rare, it would not be a dramatic price to pay.
After further investigation, I consider this a design bug in both message()
and warning()
. I've posted this to R-devel thread 'message(
/cc @DavisVaughan
Luke T replied and said that the current behavior is expected and by design. From his reply, I conclude that using message(e)
as in:
tryCatch(stop("boom"), error = function(e) message(e))
is incorrect and that one should indeed use:
tryCatch(stop("boom"), error = function(e) message(conditionMessage(e)))
From https://stackoverflow.com/questions/66083734/handling-exceptions-using-trycatch-inside-future-applyfuture-lapply/67815186#67815186:
Issue
Calling
message(cond)
on a captured error conditioncond
are caught by the future despite being muffled internally bymessage()
. Same forwarning()
.Troubleshooting
Both
message()
andwarning()
use something like:internally. Indeed, if we do:
More details: