powered by
Drop-in replacement for purrr::safely that captures errors and returns them in a structured format.
s_safely(.f, otherwise = NULL, quiet = TRUE)
A function that returns a list with 'result' and 'error' components.
A function to wrap for safe execution.
Default return value when an error occurs.
Logical. Hide errors from console if TRUE.
safe_log <- s_safely(log) safe_log(10) # Returns list(result = 2.30, error = NULL) safe_log("a") # Returns list(result = NULL, error = )
Run the code above in your browser using DataLab