You can use a calling handler along with sys.calls, something like

    f <- function() g()
    g <- function() stop("A")

    tryCatch(withCallingHandlers(f(),
                                 error = function(e) {
                                                  e$calls <- sys.calls()
                                     signalCondition(e)
                                 }),
             error = function(e) e)

Best,

luke

On Wed, 2 Sep 2009, Hadley Wickham wrote:

Hi all,

The help for traceback states:

 Errors which are caught _via_ 'try' or 'tryCatch' do not generate
 a traceback, so what is printed is the call sequence for the last
 uncaught error, and not necessarily for the last error.

Is there any way to get a traceback (or something similar) for an
error raised inside a try block?

Regards,

Hadley




--
Luke Tierney
Chair, Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
   Actuarial Science
241 Schaeffer Hall                  email:      l...@stat.uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to