
Last chance! 50% off unlimited learning
Sale ends in
Does a given expression return an error? Useful for tests where you want to make sure your function throws an error.
is.error(expr, tell = FALSE, force = FALSE)
Expression to be tested for returning an error
Logical: Should the error message be printed via message
? DEFAULT: FALSE
Logical: Should an error be returned if the expression is not an error? DEFAULT: FALSE
TRUE/FALSE
# NOT RUN {
is.error( log(3) )
is.error( log("a") )
is.error( log(3), tell=TRUE )
is.error( log("a"), tell=TRUE )
stopifnot( is.error( log("a") ) ) # or shorter:
is.error( log("a"), force=TRUE)
# is.error( log(3), force=TRUE)
stopifnot(is.error( is.error(log(3), force=TRUE) ))
# }
Run the code above in your browser using DataLab