| format_trace | R Documentation |
Formats the $calls carried by an rtemis_error condition (see
abort()) as a numbered, one-line-per-frame string. Most-recent frame
at the bottom, matching base R's traceback() convention. Each frame is
deparsed with a single-line cap so long calls stay readable; no styling
is applied, so the output is safe for any sink (terminal, JSON, HTML).
format_trace(trace, max_width = 80L)
trace |
|
max_width |
Integer: Max characters per deparsed line. Longer calls are truncated with a trailing ellipsis. Ignored for rlang traces, which rlang formats itself. |
Conditions from packages built on rlang::abort() carry their stack as
an rlang trace object on $trace rather than on $calls. Those are
passed to rlang's own formatter, so the result is rlang's tree layout
and max_width does not apply; any ANSI styling is stripped.
Character scalar with one frame per \n-separated line,
newest frame last. "" if the trace is empty or NULL.
EDG
## Not run:
cond <- tryCatch(
check_numeric("oops"),
error = identity
)
cat(format_trace(cond), "\n")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.