Extended version of try with support for tracebacks and
crash dumps.
etry(
expr,
silent = FALSE,
outFile = getOption("try.outFile", default = stderr()),
max.lines = 100L,
dump.frames = c("partial", "full", "full_global", "no")
)# S3 method for `etry-error`
print(
x,
max.lines = getOption("traceback.max.lines", getOption("deparse.max.lines", -1L)),
...
)
For etry, the value of the expression if expr is
evaluated without error, but an invisible object of class
c("etry-error", "try-error") containing the error message if it
fails. This object has three attributes: (condition) the error condition,
(traceback) the traceback as returned by
.traceback, (dump.frames) the crash dump
which can be examined using utils::debugger.
an R expression to try.
logical: should the report of error messages be suppressed?
a connection, or a character string naming the
file to print to (via cat(*, file = outFile));
used only if silent is false, as by default.
for etry, the maximum number of lines to be
deparsed per call. For print, the maximum number of lines to
be printed per call. The default for the latter is unlimited.
should a crash dump (cf. dump.frames)
be created in case of an error? The default "partial" omits the frames up
to the call of etry. "full" and "no" do the obvious. "full_global"
additionally also includes (a copy of) the global environment (cf.
include.GlobalEnv argument of dump.frames).
an object of class "etry-error".
further arguments passed to or from other methods.
Fully supported on Windows.