here's a example function, let's say i'm unable able to edit it.
myfun <- function(){ x <- 1 ; stop( "error here" ) }
when the stop() occurs, how would i access the object x to see what it was?
not sure if i should use something like this, or if i need something related to dump.frames, or if this is simply not possible without changing myfun()
withCallingHandlers( myfun() , error = function(e){ print( e ) } )
i am looking for something similar to this behavior, but need to do it without myfun()
myfun <- function(){ on.exit( print( x ) ) ; x <- 1 ; stop( "error here" ) }
myfun()
for my use-case, i am unable to change myfun() because there are about fifty functions, but i want to know a consistently-named object within each of them at time of error
thanks!