r - Make result in tryCatch expr available to warning handler -
in usual implementation of trycatch
, warning handler returns custom value, e.g.
trycatch(expr, warning = function(w) { print(w) ; return(null) }
what if want warning handler return result of expr
without running expr
again? (the reason expr
api call cuts limit.) tried
trycatch({res <- expr; return(res)}, warning = function(w) { print(w) ; return(res) }
but of course doesn't work because res
not available in warning
handler.
Comments
Post a Comment