Hi,

tryCatch seems to be evaluating the all expressions wrapped in it before 
passing control to the error handling function.  For example, the code below 
will try to evaluate "results" even though the call to odbcConnect fails.  I 
was hoping that the mechanism would work in the same way as a C++ try catch 
structure and pass control to the catch... as soon as an exception is 
generated.  Am I expecting too much or is there a way to tryCatch... multiple 
statements in R?

tryCatch(
{
        conn<-odbcConnect(...
        results<-sqlQuery(...
}
,
error=function(err)myErrorHandler(...
)


.

This message is intended only for the use of the person(s) to whom it is 
addressed. It may contain information which is privileged and confidential. 
Accordingly any unauthorised use is strictly prohibited. If you are not the 
intended recipient, please contact the sender as soon as possible.

It is not intended as an offer or solicitation for the purchase or sale of any 
financial instrument or as an official confirmation of any transaction, unless 
specifically agreed otherwise. All market prices, data and other information 
are not warranted as to completeness or accuracy and are subject to change 
without notice. Any opinions or advice contained in this Internet email are 
subject to the terms and conditions expressed in any applicable governing 
Marble Bar Asset Management LLP's  terms and conditions of business or client 
agreement letter. Any comments or statements made herein do not necessarily 
reflect those of Marble Bar Asset Management LLP.

Marble Bar Asset Management LLP is regulated and authorised by the FSA.
        [[alternative HTML version deleted]]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to