Dear R-Users, I am somewhat confused by the interplay between options(error=) and try(). I set my error handler to an expression that dumps the frames and quits. Yet, I thought that this handler would NOT be invoked if an error happens within try(). Apparently it was. Here is the code that I ran as R BATCH: options(error=quote({dump.frames("t.dump", to.file=TRUE); q()})) try({ stop("error in try") }) cat("OK\n") And this is the log:> options(error=quote({dump.frames("t.dump", to.file=TRUE); q()})) > > > try({ stop("error in try") })Error in try({ : error in try So my question is why the error handler was invoked within try() and what do I need to do to avoid this? Thank you, Vadim -------------------------------------------------- DISCLAIMER \ This e-mail, and any attachments thereto, is intend ... [[dropped]]
On Tue, 7 Jan 2003, Vadim Ogranovich wrote:> Dear R-Users, > > I am somewhat confused by the interplay between options(error=) and try(). I > set my error handler to an expression that dumps the frames and quits. Yet, > I thought that this handler would NOT be invoked if an error happens within > try(). Apparently it was. Here is the code that I ran as R BATCH:The current implementation of try does not override the error handler setting provided in options. This will change when a more sophisticated error handling mechanism currently under development is released. For now I thnk your only option is to disable your error handler around the try. luke -- Luke Tierney University of Iowa Phone: 319-335-3386 Department of Statistics and Fax: 319-335-3017 Actuarial Science 241 Schaeffer Hall email: luke at stat.uiowa.edu Iowa City, IA 52242 WWW: http://www.stat.uiowa.edu