failWith {sparrow} | R Documentation |
Inspired from one of Hadley's functions (in plyr or something?)
failWith( default = NULL, expr, frame = parent.frame(), message = geterrmessage(), silent = FALSE, file = stderr() )
default |
the value to return if |
expr |
the expression to take a shot at |
frame |
the frame to evaluate the expression in |
message |
the error message to display if |
silent |
if |
file |
where msg sends the message |
the result of expr
if successful, otherwise default
value.
# look, this doesn't throw an error, it just returns NULL x <- failWith(NULL, stop("no error, just NULL"), silent = TRUE)