stacktrace: A traceback function to be used with error handling.

Description Usage Examples

View source: R/stacktrace.R

Description

To use, call options(error = stacktrace), which will be called by default when this package is loaded.

Usage

1

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
  # /Users/you/tmp/foo.R
  foo <- function() { bar() + 1 }
  bar <- function() { baz() + 2 }

  # R console
  source("~/tmp/foo.R")
  foo()
  # Error in bar() : could not find function "baz"
  # In global environment: foo()
  # In /Users/robertk/tmp/foo.R:1: bar() + 1
  # In /Users/robertk/tmp/foo.R:2: baz() + 2
  #
  # could not find function "baz"

## End(Not run)

robertzk/bettertrace documentation built on July 23, 2019, 2:22 p.m.