【发布时间】:2017-07-18 22:31:12
【问题描述】:
检查以下示例:
library(testthat)
expect_warning(tryCatch(stop("Error!"), error = function(e) warning(e)))
## Error: tryCatch(stop("Error!"), error = function(e) warning(e)) showed 0 warnings
## In addition: Warning message:
## In doTryCatch(return(expr), name, parentenv, handler) : Error!
为什么 testthat 说没有警告?
使用withWarnings function discussed in here 也没有任何警告迹象。为什么tryCatch 在被要求时不会产生警告?
【问题讨论】: