https://github.com/cran/SoDA
Tip revision: e3fb24ebd97f7686caee78bcef4e558b908a465e authored by jmc on 01 December 2007, 00:00:00 UTC
version 0.97-1
version 0.97-1
Tip revision: e3fb24e
muststop.R
muststop <- function(expr, silent = TRUE) {
tryExpr <- substitute(tryCatch(expr, error=function(cond)cond))
value <- eval.parent(tryExpr)
if(inherits(value, "error")) {
if(!silent)
message("muststop reports: ", value)
invisible(value)
}
else
stop(gettextf("The expression %s should have thrown an error, but instead returned an object of class \"%s\"",
deparse(substitute(expr))[[1]], class(value)))
}