Getting traceback in custom error handler in R -
i have function stop
loaded library lib
. replace default error handler in r function using options(error = stop)
. within function, traceback may display calls leading error being thrown. however, sys.calls
not seem work within custom error handler. returns single element, is body of stop
rather call. may have how r intercepts error handler stop
. furthermore, traceback
not work within stop
. there way can proper traceback in custom error handler?
this works me:
> fun <- function(x) stop('hello') > stop <- function() print(sys.calls()) > options(error=stop) > fun(1) error in fun(1) : hello [[1]] fun(1) [[2]] stop("hello") [[3]] (function () print(sys.calls()))()
this on r 3.1.2. doing different?
Comments
Post a Comment