tryLog | R Documentation |
tryLog
is implemented by calling tryCatchLog
and 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), write.error.dump.folder = getOption("tryCatchLog.write.error.dump.folder", "."), silent.warnings = getOption("tryCatchLog.silent.warnings", FALSE), silent.messages = getOption("tryCatchLog.silent.messages", FALSE), include.full.call.stack = getOption("tryCatchLog.include.full.call.stack", TRUE), include.compact.call.stack = getOption("tryCatchLog.include.compact.call.stack", TRUE), logged.conditions = getOption("tryCatchLog.logged.conditions", NULL), execution.context.msg = "" )
expr |
R expression to be evaluated |
write.error.dump.file |
|
write.error.dump.folder |
|
silent.warnings |
|
silent.messages |
|
include.full.call.stack |
Flag of type |
include.compact.call.stack |
Flag of type |
logged.conditions |
|
execution.context.msg |
a text identifier (eg. the PID or a variable value) that will be added to msg.text
for catched conditions. This makes it easier to identify the runtime state that caused
a condition esp. in parallel execution scenarios.
The value must be of length 1 and will be coerced to character.
Expressions are not allowed.
The added output has the form: |
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.
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.
tryCatchLog
,
last.tryCatchLog.result
tryLog(log(-1)) # logs a warning (logarithm of a negative number is not possible) tryLog(log("a")) # logs an error tryCatchLog(log(-1), execution.context.msg = Sys.getpid())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.