NCEAS / recordr

Provenance tracking for R.
20 stars 1 forks source link

record() doesn't honor options(warn) setting #66

Closed gothub closed 7 years ago

gothub commented 7 years ago

R option warn < 2 will allow a sourced script to run completely even if a warning is encountered in the script. When record() sources a user script, it does so in a tryCatch block (as required specifically of recordr by CRAN), which causes control to return from the record() source script immediately when any warning is encountered.

gothub commented 7 years ago

To resolve this, if warn is set to < 2, record() will source the user script with suppressWarnings() so that the script can complete even if a warning is encountered. If warn >=2, then the script is sourced without suppressWarnings() and warnings (treated as errors now) will cause the script.

The result is that running an R script directly with source() and with record() has the same error handling behaviour, whatever the user has set option(warn) to be.

Fixed in commit b7a5e78936588a086a2dfaec30943ba3255ab81f