From vogranovich at jumptrading.com  Fri Oct 15 20:27:56 2010
From: vogranovich at jumptrading.com (Vadim Ogranovich)
Date: Fri, 15 Oct 2010 13:27:56 -0500
Subject: [Rd] calling browser on error
Message-ID: <25C02255A75A684A9CF77F7D663B438F95180C77@chiexchange02.w2k.jumptrading.com>

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.



[Rd] calling browser on error
Vadim Ogranovich