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
get.pretty.call.stack(call.stack, omit.last.items = 0, compact = FALSE)
Call stack object created by sys.calls
Number of call stack items to drop from the end of the full stack trace
TRUE will return only call stack items that have a source code reference (FALSE all)
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).
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.