Skip to content
Prev 1373 / 12125 Next

[R-pkg-devel] best way the handle errors conditionally

On Mon, 2017-03-06 at 11:17 +0100, Thierry Onkelinx wrote:
Specifically to DBI and SQL transaction support, you should consider
using dbWithTransaction(), which is designed to do exactly what you're
asking for here, with dbBegin, dbCommit, and dbRollback.

For tryCatch in this mode, which doesn't seem to be the best pattern,
I'd probably suggest wrapping complicated series of commands in
functions, and calling those within one or more tryCatch constructs. 
You would probably want to break it up so that you could call
dbRollback earlier than the very end of a long sequence of commands.

Regards,

Brian