Dear R-developers,

I am trying to figure out a way to call browser() when an error occur, and 
naturally I want the browser() to be called in the environment of the error.

I tried something simple in vain:

> f <- function() { x <- 1; stop('ok') }
> tryCatch(f(), error=browser())
Called from: tryCatch(f(), error = browser())
## if browser() was called in the local environment of f then 'x' would be set, 
but it's not
Browse[1]> x
Error: object 'x' not found
Browse[1]> Q

Is there a way to make it work? What do people do to 'set an on-error 
breakpoint'?

Thanks,
Vadim


Note: This email is for the confidential use of the named addressee(s) only and 
may contain proprietary, confidential or privileged information. If you are not 
the intended recipient, you are hereby notified that any review, dissemination 
or copying of this email is strictly prohibited, and to please notify the 
sender immediately and destroy this email and any attachments.  Email 
transmission cannot be guaranteed to be secure or error-free.  Jump Trading, 
therefore, does not make any guarantees as to the completeness or accuracy of 
this email or any attachments.  This email is for informational purposes only 
and does not constitute a recommendation, offer, request or solicitation of any 
kind to buy, sell, subscribe, redeem or perform any type of transaction of a 
financial product.

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

Reply via email to