setDreamerr_show_stack {dreamerr}R Documentation

Settings telling whether or not to display the full call stack on errors

Description

Errors generated with dreamerr functions only shows the call to which the error should point to. If setDreamerr_show_stack is set to TRUE, error will display the full call stack instead.

Usage

setDreamerr_show_stack(show_full_stack = FALSE)

Arguments

show_full_stack

Logical scalar, default is FALSE. If TRUE, then errors generated by dreamerr functions (like stop_up()/stopi()) will display the full call stack.

Author(s)

Laurent Berge

Examples


# Let's create a toy example of a function relying on an internal function
# for the heavy lifting (although here it's pretty light!)
make_sum = function(a, b){
  make_sum_internal(a, b)
}

make_sum_internal = function(a, b){
  if(!is.numeric(a)) stop_up("arg. 'a' must be numeric!")
  a + b
}

# By default if you feed stg non numeric, the call shown is 
# make_sum, and not make_sum_internal, since the user could not
# care less of the internal structure of your functions

try(make_sum("five", 55))

# Now with setDreamerr_show_stack(TRUE), you would get the full call stack
setDreamerr_show_stack(TRUE)
try(make_sum("five", 55))




[Package dreamerr version 1.4.0 Index]