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 sys.calls

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:

  1. Call stack items consist of:
    <call stack item number> [<file name>#<row number>:] <expression executed by this code line>

  2. The last call stack items with a file name and row number points to the source code line causing the error.

  3. 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


[Package tryCatchLog version 1.3.1 Index]