Condition classes
Error, warning, and message classes derived from their simple equivalents.
assertionError(message, call = NULL, predicate_name = NULL) assertionWarning(message, call = NULL, predicate_name = NULL) assertionMessage(message, call = NULL, predicate_name = NULL)
message |
A string describing the problem. |
call |
A call describing the source of the condition. |
predicate_name |
A string naming the predicate that was called when the condition occured. |
An object of class assertionError, assertionWarning, or
assertionMessage.
These objects behave the same as the standard-issue simpleError,
simpleWarning, and simpleMessage objects from base-R. The
extra class allows you to provide custom handling for assertions inside
tryCatch.
tryCatch(
assert_all_are_true(FALSE),
error = function(e)
{
if(inherits(e, "assertionCondition"))
{
# Handle assertions
message("This is an assertion condition.")
# Handle assertions cause by a specific predicate
if(e$predicate_name == "is_true")
{
}
} else
{
# Handle other error types
}
}
)Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.