ColinFay / attempt

Tools for defensive programming in R
Other
124 stars 12 forks source link

Bug when using try_catch with a variable #2

Closed ColinFay closed 6 years ago

ColinFay commented 6 years ago
library(attempt)

a <- 1
try_catch(log(a), 
          .e = ~ .x)
<simpleError in doTryCatch(return(expr), name, parentenv, handler): objet 'a' introuvable>

log_it <- function(a){
  try_catch(log(a), 
            .e = ~ .x)
}

log_it(1)
<simpleError in doTryCatch(return(expr), name, parentenv, handler): objet 'a' introuvable>