get.pretty.call.stack {tryCatchLog} | R Documentation |
Pretty formatted call stack enriched with the source file names and row numbers
Description
Enriches the current call stack with the source file names and row numbers to track the location of thrown conditions and generates a prettily formatted list of strings
Usage
get.pretty.call.stack(call.stack, omit.last.items = 0, compact = FALSE)
Arguments
call.stack |
Call stack object created by |
omit.last.items |
Number of call stack items to drop from the end of the full stack trace |
compact |
TRUE will return only call stack items that have a source code reference (FALSE all) |
Details
How to read the call stack:
Call stack items consist of:
<call stack item number> [<file name>#<row number>:] <expression executed by this code line>
The last call stack items with a file name and row number points to the source code line causing the error.
Ignore all call stack items that do not start with a file name and row number (R internal calls only)
You should only call this function from within withCallingHandlers
, NOT from within tryCatch
since tryCatch unwinds the call stack to the tryCatch position and the source of the condition cannot be identified anymore.
Value
The call stack (sys.calls
) without the last number of function calls (given by "omit.last.items")
to remove irrelevant calls caused e. g. by exception handler (withCallingHandlers
)
or restarts (of warnings).
See Also
tryCatchLog
, tryLog
, limitedLabelsCompact