Drop-in replacement for purrr::safely that captures errors and returns them in a structured format.
Examples
safe_log <- s_safely(log)
safe_log(10) # Returns list(result = 2.30, error = NULL)
#> $result
#> [1] 2.302585
#>
#> $error
#> NULL
#>
safe_log("a") # Returns list(result = NULL, error = <error>)
#> $result
#> NULL
#>
#> $error
#> <simpleError in .f(...): non-numeric argument to mathematical function>
#>