tryLog is a wrapper function around tryCatchLog
that traps any errors that occur during the evaluation of an expression without stopping the execution
of the script (similar to try). Errors, warnings and messages are logged.
In contrast to tryCatchLog it returns but does not stop in case of an error and therefore does
not have the error and finally parameters to pass in custom handler functions.
tryLog(expr,
write.error.dump.file = getOption("tryCatchLog.write.error.dump.file",
FALSE), silent.warnings = getOption("tryCatchLog.silent.warnings", FALSE),
silent.messages = getOption("tryCatchLog.silent.messages", FALSE))expression to be evaluated
TRUE: Saves a dump of the workspace and the call stack named dump_<YYYYMMDD_HHMMSS>.rda
TRUE: Messages are logged, but not propagated to the caller.
FALSE: Messages are logged and propagated to the caller.
The value of the expression (if expr is evaluated without an error.
In case of an error: An invisible object of the class "try-error" containing the error message
and error condition as the "condition" attribute.
tryLog is implemented using tryCatchLog. If you need need more flexibility for
catching and handling errors use the latter.
Error messages are never printed to the stderr connection but logged only.
# NOT RUN {
tryLog(log(-1)) # logs a warning
tryLog(log("a")) # logs an error
# }
Run the code above in your browser using DataLab