severeifnot.Rd
Similar to base::stopifnot, but allows you to use a custom message and
logger level. If all conditions are TRUE
, silently exit.
severeifnot(msg, ...) errorifnot(msg, ...) warnifnot(msg, ...) infoifnot(msg, ...) debugifnot(msg, ...)
msg | Logger message to write, as a single character string. |
---|---|
... | Conditions to evaluate |
Invisibly, TRUE
if conditions are met, FALSE
otherwise
Conditions can be vectorized, or can return non-logical values.The
underlying function automatically applies isTRUE(all(.))
to the
conditions.
# NOT RUN { a <- 1:5 b <- list(6, 7, 8) debugifnot("By the way, something is not a list.", is.list(a), is.list(b)) infoifnot("Something is not a list.", is.list(a), is.list(b)) warnifnot("I would prefer it if you used lists.", is.list(a), is.list(b)) errorifnot("You should definitely use lists.", is.list(a), is.list(b)) try({ severeifnot("I absolutely cannot deal with the fact that something is not a list.", is.list(a), is.list(b)) }) # }