| ftry {futile.logger} | R Documentation |
Wrap a try block in futile.logger
Description
This function integrates futile.logger with the error and warning system so problems can be caught both in the standard R warning system, while also being emitted via futile.logger.
Usage
ftry(expr, error = stop, finally = NULL, silent = FALSE, details = "")
Arguments
expr |
The expression to evaluate in a try block |
error |
An error handler |
finally |
Pass-through to tryCatch finally |
silent |
Boolean - should errors be rethrown? The same as the silent option on 'try'. If a custom error handler is being used that takes control over this option. Note you should test the return value if you are dependent on it. |
details |
An extra string to print when there's a warning message |
Author(s)
Brian Lee Yung Rowe
Examples
## Not run:
ftry(log("a")) # Logs the warning (but the warning still bubbles)
x <- 'a'
y <- 2 # Some ID associated with x value
ftry(log("a"), details=sprintf("y = %s",y))
ftry(log(-1)) # Logs the error and rethrows it
## End(Not run)
ftry(log(-1),silent=TRUE) # logs the error and silently continues
[Package futile.logger version 1.4.9 Index]